10000的阶乘毫无思路
问题同上,谁给个思路#include<stdio.h> void Fact(int n) { int a[20000] = {1},f,i,j,len = 1; for(i = 2;i<=n;i++) { for(f = 0,j = 0;j<len;j++) { if(!(a[j] || f))continue; a[j] = a[j]*i + f; f = a[j]/10000; a[j] %= 10000; } if(f)a[len++] = f; } printf("%d",a[--len]); while(len--)printf("%04d",a[len]); printf("\n"); } int main(void) { int n; while(~scanf("%d", &n)) Fact(n); return 0; }