蓝桥杯练习题—— 阶乘计算

/* ****************************************** Title: 蓝桥杯练习题—— 阶乘计算 ****************************************** Date:2014/03/13 ****************************************** author:刘旭 ****************************************** */#include #include using namespace std; #define N30000 int a[N]= {1}; int main() { int n,pos,maxpos = 0; cin>>n; for(int i = 1; i <= n; i++) { int temp = 0; for (pos = 0; pos <= maxpos ; pos++) { temp += a[pos]*i; a[pos] = temp%10; temp /=10; } while(temp) { a[pos++] = temp%10; temp /=10; } pos--; maxpos = pos > maxpos? pos :maxpos; } maxpos++; while(maxpos--) cout<


    推荐阅读