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 |
有bt数据吗为什么我总是WA#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator