HUST Online Judge WebBoard
Problem 4068 >> 为什么会答案错误 9%
201803140220 @ 2019-03-31 19:30:30
[ Quote ] [ Edit ] [ Delete ] 1#
#include <stdio.h>

int factor(int x);

int main()
{
int x,sum;

scanf("%d",&x);

sum=factor(x);

printf("%d\n",sum);

return 0;
}

int factor(int x)
{
int i,sum=0,s=1;

for(i=1;i<=x;i++)
{
s=s*i;
sum=sum+s;
}

return sum;
}
201703120121 @ 2019-04-02 22:03:38
[ Quote ] [ Edit ] [ Delete ] 2#
有组测试数据是空的。已重判。