| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:高手帮忙帮改下啊 麻烦In Reply To:高手帮忙 Posted by:123WANGSONG at 2009-08-10 17:09:57 #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int record[3005];
int absolute[3005];
int n;
while(cin>>n)
{
cin>>record[0];
for(int i=1;i<n;i++)
{
cin>>record[i];
absolute[i-1]=abs(record[i]-record[i-1]);
}
sort(absolute,absolute+n-1);
// cout<<"absolute[n-2]"<<absolute[n-2]<<" n-1 is "<<n-1<<endl;
int flag=0;
for(int j=0;j<=n-2;j++)
{
if(absolute[j]!=j+1)
{
cout<<"Not jolly"<<endl;
flag=1;
break;
}
}
if(flag==0)
cout<<"Jolly"<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator