_cd230148lcy_ @ 2024-04-04 17:00:23
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,t=1,s=0;
cin>>n;
for(i=1;i<=n;i++)
{
t=t*i;
s+=t;
}
cout<<s;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int jc(int a)
{
int s=1;
for(int i=1;i<=a;i++)
{
s=s*i;
}
return s;
}
int main()
{
int n,s=0;
cin>>n;
for(int i=1;i<=n;i++)
{
s+=jc(i);
}
cout<<s;
return 0;
}
两个都是50分 找不出为什么 大佬帮忙看下
by Henry2012 @ 2024-04-04 17:01:48
开高精
by Henry2012 @ 2024-04-04 17:02:06
或者python
by _cd230148lcy_ @ 2024-04-04 18:36:12
@Henry2012 sorry 蒟蒻不懂
by XianYuzhinan @ 2024-04-07 13:22:25
@cd230148lcy 这题用的是高精度算法,可以去网上搜教程
by _cd230148lcy_ @ 2024-04-07 19:41:15
@XianYuzhinan OK