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

怎么会出现output limit exceed呢?不是遇-1就结束吗?

Posted by BlueBlood at 2004-12-26 08:58:54 on Problem 1775
我的源代码如下:
#include <iostream.h>

long fac[10] = { 1,1,2,6,24,120 ,720,5040,40320,362880};

int main()
{
	long n;
	int i;

	cin>>n;

	while ( n != -1 ) 
	{
		i = 9;
		while (  n >= 0 && i >= 0 )
		{
			if ( fac[i] <= n ) 
				n = n - fac[i];
			i --;
		}

		if ( n == 0 )
			cout << "YES";
		else
			cout << "NO";
		cout << endl;

		cin>>n;
	}

	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