#include <stdio.h> #define N 10005 // N can be change 1~100000 int a[N]={1},i,n,c,m,t; int main(){ int x = 100000; //need to change, x is the base of number //n = N; //need to change, n is max number of the N! //if call it as the function ,you should use the "memset()" function while(scanf("%d",&n)!=EOF) { memset(a,0,sizeof(a)); a[0] = 1; //and make a[0] = 1,each time! m=0; for(;n;n--){ for(c=i=0;i<=m;i++) a[i]=(c+=a[i]*n)%x,c/=x; while(c) a[++m]=c%x,c/=x; } printf("%d",a[m--]); for(;m>=0;m--) { printf("%05d",a[m]); } printf("/n"); } return 0; }