Why_failed_to_build @ 2024-11-13 22:44:01
#include<stdio.h>
int jc(int n){
int jc=1;
for(int j=1;j<=n;j++){
jc=jc*j;
}
return jc;
}
int main(){
int n,i;
int sum=0;
scanf("%d",&n);
for(i=1;i<=n;i++){
sum=sum+jc(i);
}
printf("%d",sum);
return 0;
}
by maggieee527 @ 2024-11-14 14:16:07
高精度啊高精度
by hdbcool @ 2024-11-15 16:57:13
为啥用了函数就50分啊
by winner999 @ 2024-11-20 18:25:22
我也是
by winner999 @ 2024-11-20 18:25:52
#include <bits/stdc++.h>
using namespace std;
long long jc(int x) {
long long ret = 1;
for (int i = 1;i <= x; i++) {
ret = ret * i;
}
return ret;
}
int main () {
int n;
cin >> n;
int sum = 0;
for (int i = 1;i <= n;i++) {
long long ret1 = jc(i);
sum += ret1;
}
printf("%d",sum);
return 0;
}