标签:
1 #include<cstdio> 2 using namespace std; 3 4 int main() 5 { 6 int i,n,digit,temp,carry,j; 7 int a[40005]; 8 while(scanf("%d",&n)!=EOF) 9 { 10 a[0]=1; 11 digit=0; 12 for(i=2;i<=n;i++) 13 { 14 for(carry=0,j=0;j<=digit;j++) 15 { 16 temp=a[j]*i+carry; 17 a[j]=temp%10; 18 carry=temp/10; 19 } 20 while(carry) 21 { 22 a[++digit]=carry%10; 23 carry/=10; 24 } 25 } 26 for(i=digit;i>=0;i--) 27 printf("%d",a[i]); 28 printf("\n"); 29 } 30 return 0; 31 }
标签:
原文地址:http://www.cnblogs.com/homura/p/4674235.html