碾转相除法

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <iterator>
#include <vector>
#define maxn 10000005
typedef long long ll;
using namespace std;
ll gcd(ll m,ll n){
    if(m%n==0){
        return n;
    }
    return gcd(n,m%n);
}
int main(){
    
        ll m,n;
        cin>>m>>n;
    //    cout<<__gcd(m,n)<<endl;
        cout<<gcd(m,n)<<endl;
    


    return 0;
}

 

posted @ 2022-02-22 19:42  lwx_R  阅读(29)  评论(0编辑  收藏  举报