A29904.小坤的最大公约数 题解
2025-06-07 21:58:57
发布于:北京
6阅读
0回复
0点赞
辗转相除法
#include <bits/stdc++.h>
using namespace std;
int gcd(int x,int y){
if (x%y==0) return y;
return (gcd(y,x%y));
}
int main(){
int a,b;
cin>>a>>b;
int x=gcd(a,b);
cout<<x;
return 0;
}
这里空空如也
有帮助,赞一个