mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 13:16:26 +00:00
872. 最大公约数
https://www.acwing.com/problem/content/submission/code_detail/7242550/
This commit is contained in:
parent
d71d5e8ad8
commit
4bc93bb684
18
AcWing/872/872.cpp
Normal file
18
AcWing/872/872.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int gcd(int a, int b) {
|
||||
if (!b) return a;
|
||||
return gcd(b, a % b);
|
||||
}
|
||||
|
||||
int main() {
|
||||
int n, a, b;
|
||||
cin >> n;
|
||||
while (n--) {
|
||||
cin >> a >> b;
|
||||
cout << gcd(a, b) << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user