首页 > 其他分享 >04

04

时间:2022-10-28 16:36:42浏览次数:33  
标签:std return gcd 04 int n%

#include<bits/stdc++.h>
using namespace std;
class gcd
{
public:
int a,b;
int n,m;
int f(int a,int b)
{
if(a>b){
n=a;
m=b;
}
else {
n=b;
m=a;
}
if(n%m==0)
return m;
return f(n%m,m);
}
};
int main() {
gcd p;
cin>>p.a>>p.b;
cout<<p.f(p.a,p.b)<<endl;

return 0;
}

标签:std,return,gcd,04,int,n%
From: https://www.cnblogs.com/sunyang13763857269/p/16836533.html

相关文章