From 6e6213f28101a359ade0b20077d39ba30799b998 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 26 Sep 2022 16:52:44 +0800 Subject: [PATCH] A - mod M https://atcoder.jp/contests/arc148/submissions/35176980 --- AtCoder/ARC148/A/A.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 AtCoder/ARC148/A/A.cpp diff --git a/AtCoder/ARC148/A/A.cpp b/AtCoder/ARC148/A/A.cpp new file mode 100644 index 00000000..11e4389b --- /dev/null +++ b/AtCoder/ARC148/A/A.cpp @@ -0,0 +1,31 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 2e5 + 5; + +int n, a[N], ans; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n; + + for (int i = 1; i <= n; i++) { + cin >> a[i]; + } + + std::sort(a + 1, a + 1 + n); + + for (int i = 2; i <= n; i++) { + ans = std::__gcd(ans, a[i] - a[i - 1]); + } + + cout << (ans == 1 ? 2 : 1) << endl; + + return 0; +}