2025-03-31 02:08:39
#include<
long fac(int n)//求n的
{
if(n==1)return 1L;//当n为1,
else return n*fac(n-1);//计算n的阶乘;
}
long sum(int n)//求阶乘相加之和;
{
int s,k;
for(s=0,k=0;k<=n,n>0;k++){
s=s+fac(n);
n=n-1;
}
return s;
}
void main()//
{
int m;
scanf("%d",&m);
printf("%d\n",sum(m));
}
2025-03-31 00:17:00