From 7eab5ffb7f64a26c375231c00bafa5d72e3ad997 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Thu, 24 Sep 2020 19:17:57 +0800 Subject: [PATCH] =?UTF-8?q?P1152=20=E6=AC=A2=E4=B9=90=E7=9A=84=E8=B7=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R38820772 --- problem/P1152/P1152.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 problem/P1152/P1152.cpp diff --git a/problem/P1152/P1152.cpp b/problem/P1152/P1152.cpp new file mode 100644 index 00000000..2df452f9 --- /dev/null +++ b/problem/P1152/P1152.cpp @@ -0,0 +1,25 @@ +// R38820772 + +#include + +using namespace std; + +bool cnt[10000005]; +int n, a[1005]; + +int main() { + cin >> n; + for(int i = 0 ; i < n ; i++) { + cin >>a[i]; + } + for(int i = 1 ; i < n ; i++) { + if(!cnt[abs(a[i]-a[i-1])]) { + cnt[abs(a[i]-a[i-1])] = true; + } else { + cout << "Not jolly" << endl; + return 0; + } + } + cout << "Jolly" << endl; + return 0; +}