输入2个正整数A,B,求A与B的最大公约数。
Input
2个数A,B,中间用空格隔开。(1<= A,B <= 10^9)
Output
输出A与B的最大公约数。
Sample Input
30 105
Sample Output
15
#include<iostream>
#define ll long long
using namespace std;
ll gcd(ll a,ll b)
{
return b==0?a:gcd(b,a%b);
}
int main()
{
ll a,b;
cin>>a>>b;
cout<<gcd(a,b)<<endl;
return 0;
}