标签:style blog http color io os ar for strong
1、110201/10038 Jolly Jumpers (快乐的跳跃者)
即从某个数字开始的N个连续数字
#include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> #include<ctype.h> using namespace std; int arr[3005]; bool cmp(int a,int b) { return a<b; } int main() { int n; while(scanf("%d",&n)!=EOF) { int i; for(i=0;i<n;i++) { scanf("%d",&arr[i]); } sort(arr,arr+n,cmp); bool flag=true; for(i=1;i<n;i++) { if(arr[i]==arr[i-1]) { flag=false; break; } } if(flag) { if(arr[n-1]-arr[0]>n-1) { flag=false; } } if(flag) printf("Jolly\n"); else printf("Not jolly\n"); } return 0; }
标签:style blog http color io os ar for strong
原文地址:http://www.cnblogs.com/varcom/p/4050206.html