You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
299 B

#include <bits/stdc++.h>
using namespace std;
// 最大公约数,辗转相除法
int gcd(int a, int b) {
return b ? gcd(b, a % b) : a;
}
int main() {
int n;
cin >> n;
while (n--) {
int a, b;
cin >> a >> b;
printf("%d\n", gcd(a, b));
}
return 0;
}