fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6.  
  7.  
  8. int n,s=0,r;
  9. while(cin>>n)
  10.  
  11. {
  12. int arr[n];
  13. s=0;
  14. for(int i=0;i<n;i++)
  15. {
  16. cin>>arr[i];
  17. r=abs(arr[i]-n);
  18. if(r>n)
  19. {
  20. s=1;
  21. }
  22.  
  23. }
  24. if(s==1)
  25. {
  26. cout<<"Not jolly"<<endl;
  27. }
  28. else
  29. {
  30. cout<<"Jolly"<<endl;
  31. }
  32.  
  33.  
  34.  
  35. }
  36.  
  37. return 0;
  38. }
Success #stdin #stdout 0s 3472KB
stdin
4 1 4 2 3
5 1 4 2 -1 6
stdout
Jolly
Not jolly