应在C++17及以上使用#include<numeric>
与gcd()
,否则会报错error: use of undeclared identifier 'gcd'
或__gcd()
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int a,b;
cin>>a>>b;
cout<<gcd(a,b)<<endl;//c++17
}
return 0;
}