Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

记得加一句输出:N=xx啊!因为这个嚷昂一次实在是。。。

Posted by KatrineYang at 2016-09-24 10:55:34 on Problem 1354

#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator