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> #include<stdlib.h> int num[3100]; int main() { int n; while(scanf("%d",&n)!=EOF&&n<3000) { if(n==1) //n=1另外处理 { scanf("%d",&num[0]); printf("Jolly\n"); } else { int i; //输入 for( i=0;i<n;i++) scanf("%d",&num[i]); for( i=0;i<n-1;i++)//int { num[i]=abs(num[i+1]-num[i]); } for(i=0;i<n-1;i++) //排序 { for(int j=i;j<n-1;j++) { if(num[i]>num[j]) { int temp=num[i]; num[i]=num[j]; num[j]=temp; } } } int jolly=1; //判断和输出 for( i=0;i<n-1;i++)//int if(num[i]!=i+1) jolly=0; if(jolly==1) printf("Jolly\n"); else 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