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 |
Output Limit Exceeded哪位帮忙看一下啊,疯掉啦.......................#include<stdio.h> #include<math.h> int Array[3000]; int Cha[3000]; int main (void) { int n,i,c; while(scanf("%d",&n)!=EOF) { if(n==1) { scanf("%d",&Array[0]); printf("Jolly\n"); } else if(n>1) { for(i=1;i<=n;++i) { scanf("%d",&Array[i]); } for(i=1;i<n;i++) { c=Array[i]-Array[i+1]; Cha[i]=abs(c); } if((Cha[1]==1)&&n!=2) { for(i=1;i<n;i++) { if(Cha[i]!=i) { printf("Not jolly\n"); break; } if(i==(n-1)) { printf("Jolly\n"); } } } if(Cha[1]==(n-1)) { for(i=1;i<n;i++) { if(Cha[i]!=(n-i)) { printf("Not jolly\n"); break; } if(i==(n-1)) { printf("Jolly\n"); } } } if((Cha[1]!=(n-1))&&(Cha[1]!=1)) printf("Not jolly\n"); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator