From 62ffd92f580a2de4778e9e43f50e105e14f055a2 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Wed, 1 Mar 2023 17:32:03 +0800 Subject: [PATCH] =?UTF-8?q?P4549=20=E3=80=90=E6=A8=A1=E6=9D=BF=E3=80=91?= =?UTF-8?q?=E8=A3=B4=E8=9C=80=E5=AE=9A=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.luogu.com.cn/record/103347509 --- Luogu/P4549/P4549.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Luogu/P4549/P4549.cpp diff --git a/Luogu/P4549/P4549.cpp b/Luogu/P4549/P4549.cpp new file mode 100644 index 00000000..563fa05a --- /dev/null +++ b/Luogu/P4549/P4549.cpp @@ -0,0 +1,26 @@ +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +int n, ans; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n; + + for (int i = 1, x; i <= n; i++) { + cin >> x; + + ans = std::experimental::gcd(ans, std::abs(x)); + } + + cout << ans << endl; + + return 0; +}