forhumanity @ 2024-09-27 17:59:44
#include<stdio.h>
int main()
{
int n,i;
double s=0;
scanf("%d",&n);
for(n;n>=1;n--)
{
double fact=1;
for(i=1;i<=n;i++)
{
fact*=i;
}
s+=fact;
}
printf("%.0f",s);
return 0;
}
输入3 输出9
输入50 输出31035053229546198798956772059500570594211888025595793602311618560
by xiaoli2013 @ 2024-10-01 11:22:36
@forhumanity 数据太大,溢出了