题解 | #最大公约数#
最大公约数
https://ac.nowcoder.com/acm/problem/22215
辗转相除法求最大公约数
#include<iostream>
using namespace std;int main(){
int a,b;
cin>>a>>b;
while(!((a==0)||(b==0))){
if(a>b) a%=b;
else if(a==b) {cout<<a;
return 0;}
else b%=a;
}
if(a==0) cout<<b;
else cout<<a;
}
