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

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

Posted by xiaoha at 2005-01-05 14:42:19 on Problem 1775
In Reply To:怎么会出现output limit exceed呢?不是遇-1就结束吗? Posted by:BlueBlood at 2004-12-26 08:58:54
>是一个负数结束
 我的源代码如下:
> #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