I_love_kkk_forever @ 2022-07-02 14:30:04
#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 hqc111 @ 2022-07-13 21:13:34
@lzc2010 你这是AC代码