---
# System prepended metadata

title: '*Jolly Jumpers*'
tags: [CPE-數學計算]

---

###### tags: `CPE-數學計算`
# *Jolly Jumpers*
## 題目：
![](https://i.imgur.com/K2SrLVP.png)

```
#include <bits/c++.h>
using namespace std;

int main()
{
    while(true){
        int case_number;
        int temp;
        int Jelly=0;
        vector<int> input_list;
        vector<int> count_list;
        cin>>case_number;
        for (int i=0;i<case_number;i++){
            cin>>temp;
            input_list.push_back(temp);
            temp=0;
        }
        //sort(input_list.rbegin(),input_list.rend());
        
        for (int i=0;i<case_number-1;i++){
            count_list.push_back(abs(input_list[i+1]-input_list[i]));
        }
        
        sort(count_list.rbegin(),count_list.rend());
        
        for (int i=0;i<case_number-1;i++){
            if(count_list[i]-count_list[i+1]==1){
                Jelly = 1;
            }
            else{
                Jelly = 0;
                break;
            }
        }
        if(Jelly==1&&count_list.size()==case_number-1){
            cout<<"Jolly"<<endl;
        }
        else{
            cout<<"Not jolly"<<endl;
        }
    }
}
```