标签:des style blog http io ar color os sp
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1042
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 58278 Accepted Submission(s): 16547
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 5 using namespace std; 6 int num[80000]; 7 int main () 8 { 9 int n,pre; 10 while (~scanf("%d",&n)) 11 { 12 memset(num,0,sizeof(num)); 13 num[0]=1; 14 int len=1; 15 for (int i=2; i<=n; i++) 16 { 17 pre=0; 18 for (int j=0; j<len; j++) 19 { 20 num[j]=num[j]*i+pre/10; 21 pre=num[j]; 22 num[j]=num[j]%10; 23 } 24 while (pre>9) 25 { 26 num[len]=pre/10%10; 27 len++; 28 pre/=10; 29 } 30 } 31 for (int i=len-1; i>=0; i--) 32 printf ("%d",num[i]); 33 printf ("\n"); 34 } 35 return 0; 36 }
标签:des style blog http io ar color os sp
原文地址:http://www.cnblogs.com/qq-star/p/4166128.html