Description
Input
Output
Sample Input
1 2 3
Sample Output
1 2 6
#include<stdio.h> #include<string.h> int main(){ int a[101000],n,l; while(~scanf("%d",&n)){ memset(a,0,sizeof(a)); a[0] =1; l=1; for(int i=1;i<=n;i++){ int s = 0,j; for( j=0;j<l||s;j++){ int z= a[j]*i+s; a[j] = z%10; s = z/10; } l=j; //printf("%d\n",l); } for(int j = l-1;j>=0;j--)printf("%d",a[j]); printf("\n"); } }
原文:http://blog.csdn.net/yuanhanchun/article/details/38270651