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,请各位高手指点一下,本人不胜感激!!

Posted by 20061002945 at 2007-09-15 14:00:05 on Problem 2575
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int num,a[3000];
    while(1)
	{
		cin>>num;
		if(num<=0&&num>=3000)
			break;
		for(int i=0;i<num;i++)
		{
			cin>>a[i];
		}
		int b=0;
		for(i=0;i<(num-1);i++)
		{
			if(abs(a[i+1]-a[i])!=(num-i-1))
			{
				b=1;
			    break;
			}
		}
        if(b==0) 
			cout<<"Jolly"<<endl;
        else 
			cout<<"Not jolly"<<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