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 |
高手帮忙#include<stdio.h> void main() { int n,i,j,sign=0,flag; int num[3001],abs[3001]; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&num[i]); for(i=0;i<n-1;i++) { if(num[i]>num[i+1])abs[i]=num[i]-num[i+1]; else abs[i]=num[i+1]-num[i]; } for(i=1;i<n;i++) { flag=0; for(j=0;j<n-1;j++) { if(i==abs[j]) { flag=1; break; } } if(flag==1)sign++; } if(sign==n-1 || n==1)printf("Jolly\n"); else printf("Not jolly\n"); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator