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

有bt数据吗为什么我总是WA

Posted by lhzlucky at 2006-12-20 13:47:17 on Problem 2575
#include<iostream>
#include<math.h>
using namespace std;
int a[3001];
void main()
{
	int n,i,j,t,k,f;
	while(cin>>n)
	{
		f=0;
		for(i=1;i<n;i++)a[i]=0;
		for(i=0;i<n;i++)
		{
			cin>>j;
			if(i==0)k=j;
			else
			{
				t=abs(k-j);
				k=j;
				if(t<1||t>n-1||a[t])
				{
					f=1;
					break;
				}
				else a[t]=1;
			}
		}
		if(f)cout<<"Not jolly\n";
		else cout<<"Jolly\n";
	}
}

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