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

你的算法真的很好,我改动了一下通过了,下面是代码

Posted by jiangpeng at 2007-10-23 18:54:56 on Problem 1775
In Reply To:Re:我自己运行可以,怎么提交就是runtime errer Posted by:johnlin55 at 2006-08-15 12:46:12
> 原来不用out[]来记录输出,直接输出就行了。
> out[1000]太小了
#include<iostream>
using namespace std;
int main()
{
	long int a[10]={362880,40320,5040,720,120,24,6,2,1,1};
	int in;
	cin>>in;
	while(in>=0)
	{
		if(in==0)cout<<"NO"<<endl;
		else 
		{
			for(int i=0;i<10;i++)
				if(in>=a[i])in-=a[i];
			if(in==0)cout<<"YES"<<endl;
			else cout<<"NO"<<endl;
		} 				
		cin>>in;
	}
	system("pause");
	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