'commit'
This commit is contained in:
37
LuoGu/RuMen/P1152.cpp
Normal file
37
LuoGu/RuMen/P1152.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include<bits/stdc++.h>//万能头文件
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n;
|
||||
cin >> n;
|
||||
|
||||
int arr[1000] = {0};
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
cin >> arr[i];
|
||||
}
|
||||
|
||||
set<int> s;
|
||||
for (int i = 1; i < n; i++) {
|
||||
int x = abs(arr[i] - arr[i - 1]);
|
||||
s.insert(x);
|
||||
}
|
||||
|
||||
//输出
|
||||
// set<int>::iterator it;
|
||||
// for(it=s.begin (); it!=s.end (); it++) {
|
||||
// printf("%d\n",*it);
|
||||
// }
|
||||
for (int i = 1; i <= n - 1; i++) {
|
||||
if (s.count(i) == 0) {
|
||||
cout << "Not jolly" << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == n - 1) {
|
||||
cout << "Jolly" << endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user