WindyDay @ 2023-01-02 09:30:28
by xushangyou @ 2023-01-16 22:20:01
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
int n;
int a[120];
int b[120];
void add(int a[],int b[]){
int jw = 0;
for(int i=1;i<=120;i++){
b[i] = b[i] + a[i] + jw;
jw = b[i] / 10;
b[i] = b[i] % 10;
}
}
void cheng(int a[],int c){
int jw = 0;
for(int i=1;i<=120;i++){
a[i] = a[i]*c+jw;
jw = a[i]/10;
a[i] = a[i] % 10;
}
}
int main(){
cin >> n;
a[1] = 1;
for(int i=1;i<=n;i++){
cheng(a,i);
add(a,b);
}
bool flag = 0;
for(int i=120;i>=1;i--){
if(b[i]!=0)flag=1;
if(flag) cout << b[i];
}
cout << endl;
return 0;
}
by xushangyou @ 2023-01-16 22:20:52
用这个AC
by WindyDay @ 2023-01-17 20:24:30
@xushangyou 谢谢大佬awa