DESTRUCTION_WA @ 2024-07-03 12:56:02
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
int n;
long long sum = 0,sum1 = 1;
scanf("%d", &n);
if(n == 0){
printf("1");
return 0;
}
for(int i = 1;i <= n;i++){
for(int j = 1;j <= i;j++){
sum1 *= j;
}
sum += sum1;
sum1 = 1;
}
printf("%d", sum);
return 0;
}
by lxrllllll @ 2024-07-03 13:28:03
@bored_frank
#include<iostream>
using namespace std;
int A[10010], B[10010];
int n, len;
int main(){
cin>>n;
B[0]=1;
for(int i=1;i<=n;i++){
for(int j=0;j<100;j++)
B[j]*=i;
for(int j=0;j<100;j++){
B[j+1]+=B[j]/10;
B[j]%=10;
}
for(int j=0;j<100;j++){
A[j]+=B[j];
A[j+1]+=A[j]/10;
A[j]%=10;
}
}
for(len=100;!A[len];len--);
for(int i=len;i>=0;i--)
cout<<A[i];
return 0;
}
by zzdkf20081224 @ 2024-07-07 10:28:14
高精度乘法网上搜一下
by DESTRUCTION_WA @ 2024-07-08 11:43:03
@lxrllllll @zzdkf20081224
谢谢各位大神,在下是个新手蒟蒻,啥也不会(bushi
by sea_bird @ 2024-07-08 13:00:03
@bored_frank 高精度有点类似于列竖式