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 fuliang at 2009-05-03 23:46:19 on Problem 2575
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;

int dif[3000];

int main(){
	int n;
	while(cin >> n){
		memset(dif,0,sizeof(dif));
		int pre,current;
		cin >> pre;
		int i;
		for(i = 1; i < n; i++){
			cin >> current;
			int abs_dif = abs(current - pre);
			dif[abs_dif] = 1;
			pre = current; 	
		}
		
		for(i = 1; i < n; i++){
			if(dif[i] == 0)
				break;
		}

		if(i == n)
			cout << "Jolly" << endl;
		else
			cout << "Not jolly" << endl;
	}
}

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