Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<sstream>
- #include<string>
- #include<vector>
- #include<cmath>
- #include<set>
- using namespace std;
- int main(){
- string s;
- while(getline(cin, s)){
- set<int> ss;
- vector<int> n;
- stringstream stream(s);
- int t;
- while(stream>>t) n.push_back(t);
- for(int i=0; i<n.size(); i++)
- if(i+1<n.size()) ss.insert(abs(n[i]-n[i+1]));
- set<int>::iterator it;
- bool b = true;
- int i=1;
- for(it=ss.begin(); it!=ss.end(); it++){
- if(*it!=i){
- b=false;
- break;
- }
- i++;
- }
- if(b) cout<<"Jolly"<<endl;
- else cout<<"Not jolly"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement