mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-07-07 18:06:58 +08:00
更新了许多
This commit is contained in:
33
求1~n的和.cpp
Normal file
33
求1~n的和.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stack>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
typedef long long l;
|
||||
typedef double d;
|
||||
typedef char c;
|
||||
int n;
|
||||
using namespace std;
|
||||
long long wjh(int a){
|
||||
if(a==n){
|
||||
return n;
|
||||
}
|
||||
else{
|
||||
return wjh(a+1)*a;
|
||||
}
|
||||
}
|
||||
int main(){
|
||||
cin >>n;
|
||||
if(n==0){
|
||||
cout <<1;
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
cout <<wjh(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user