0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 17:36:27 +00:00

P4549 【模板】裴蜀定理

https://www.luogu.com.cn/record/103347509
This commit is contained in:
Baoshuo Ren 2023-03-01 17:32:03 +08:00
parent a9cd8b6002
commit 62ffd92f58
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

26
Luogu/P4549/P4549.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <iostream>
#include <cmath>
#include <experimental/numeric>
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;
}