【算法代码】
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b) {
if(b==0) return a;
else return gcd(b,a%b);
}
int main() {
int n;
cin>>n;
while(n--) {
int a,b;
cin>>a>>b;
cout<<gcd(a,b)<<endl;
}
return 0;
}
/*
in:
2
3 6
4 6
out:
3
2
*/
【参考文献】
https://blog.csdn.net/hnjzsyjyj/article/details/136272280
https://blog.csdn.net/hnjzsyjyj/article/details/110733164