Advertisement
JCLC

Untitled

May 19th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5.     int n = 0, z = 0, l =0, count[3000], temp[3000], lol = 0;
  6.  
  7.     while(scanf("%d", &n) != EOF){
  8.  
  9.     for(z = 0; z < n; z++)
  10.         scanf("%d", &count[z]);
  11.  
  12.     for(z = 0; z < n - 1; z++)
  13.          temp[z] = count[z] - count[z+1];
  14.  
  15.     for(z = 0; z < n - 1; z++){
  16.         if(temp[z] < 0)
  17.           temp[z] *= -1;
  18.     }
  19.  
  20.     for(z = 0; z < n - 1; z++)
  21.         for(l = 0; l < z; l++)
  22.             if(temp[z] == temp[l] || temp[z] > n-1) lol++;
  23.  
  24.     if(lol == 0){
  25.        printf("Jolly\n");
  26.        lol = 0;
  27.     }
  28.     else{
  29.        printf("Not jolly\n");
  30.        lol = 0;
  31.     }
  32.     }
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement