mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
26 lines
455 B
C++
26 lines
455 B
C++
#include<stdio.h>
|
|
int main()
|
|
{
|
|
int a[10000];
|
|
int i,j,c,m,n;
|
|
while(scanf("%d",&n)!=EOF){
|
|
a[0]=1;
|
|
m=0;
|
|
for(i=1;i<=n;i++)
|
|
{
|
|
c=0;
|
|
for(j=0;j<=m;j++)
|
|
{
|
|
a[j]=a[j]*i+c;
|
|
c=a[j]/10000;
|
|
a[j]=a[j]%10000;
|
|
}
|
|
if(c>0) {m++;a[m]=c;}
|
|
}
|
|
printf("%d",a[m]);
|
|
for(i=m-1;i>=0;i--) printf("%4.4d",a[i]);
|
|
printf("\n");
|
|
}
|
|
return 0;
|
|
}
|