编辑器加载#include
#include
#include
char ans[1000];
char yin[1000];
void zhuanhua(int i)
{
int count;
count = 0;
while(i)
{
yin[count++] = i%10 + '0';
i = i/10;
}
}
void chengfa(char yin[])
{
int i,len1,j,m,y,len2,count;
char s[1000];
len1 = strlen(yin);
len2 = strlen(ans);
count = 0;
memset(s,0,sizeof(s));
for(i = 0;i < 1000;i++)
s[i] = '0';
for(i = 0;i < len1;i++)
{
y = 0;
count = i;
for(j = 0;j < len2;j++)
{
m = (ans[j]-'0')*(yin[i]-'0') + y + s[count] - '0';
s[count++] = m%10 + '0';
y = m/10;
}
if(y)
s[count++] = y+'0';
}
s[count] = '\0';
strcpy(ans,s);
}
int main()
{
int i,n;
while(scanf("%d",&n) != EOF)
{
memset(ans,0,sizeof(ans));
ans[0] = '1';
for(i = 1;i <= n;i++)
{
memset(yin,0,sizeof(yin));
zhuanhua(i);
chengfa(yin);
}
int len;
len = strlen(ans);
//len = strlen(yin);
for(i = len;i >= 0;i--)
printf("%c",ans[i]);
puts("");
}
return 0;
}中...