题解 | 最大公约数
最大公约数
https://www.nowcoder.com/practice/20216f2c84bc438eb5ef05e382536fd3
#include <iostream>
using namespace std;
//模板题--欧几里得算法
int gcd(int a,int b){
return b?gcd(b,a%b):a;
}
int main() {
int a, b;
cin>>a>>b;
cout<<gcd(a,b);
}
// 64 位输出请用 printf("%lld")
查看10道真题和解析