/*
10000以内的阶乘,快速计算,1s内出解
E-mail: sunkai [at] msn [dot] com
Author: SunKai
Blog:
http://www.
*/

程序代码:
#include<stdio.h>
unsigned x[8000]={0},n,p,i,j,t;
int main()
{
while(scanf("%d",&n)!=EOF)
{
x[p=7998]=1;
for(i=1;i<=n;i++)
{ x[--p]=x[--p]=0;
for(j=7998;j>p;j--) {x[j]*=i; t=j+1; x[j]+=x[t]/100000; x[t]%=100000; }
while(!x[p]) p++;
} for(printf("%u",x[p++]);p<7999;p++) printf("%05u",x[p]); printf("\n");
}
return 0;
}
My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.