Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
记得加一句输出:N=xx啊!因为这个嚷昂一次实在是。。。#include <iostream> using namespace std; int digits[202][400] = {0}; void init(){ digits[1][0] = 2; for(int i = 1; i < 200; i++){ for(int j = 0; j < 400; j++){ digits[i+1][j] = digits[i][j] * i; } int carry = 0; for(int j = 0; j < 400; j++){ digits[i+1][j] += carry; carry = digits[i+1][j]/10; digits[i+1][j]%=10; } } } int n; int main() { init(); while(1){ cin >> n; if(!(~n)) return 0; int start = 399; while(!digits[n][start]) start--; cout << "N=" << n << ":\n"; for(int i = start; i >= 0; i--) cout << digits[n][i]; cout << endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator