gcd 二进制/循环

时间:2021-02-02 10:25:40
#include<bits/stdc++.h>
#define LL long long
using namespace std; inline aabs(LL x){
return x>?x:-x;} inline LL gcd(LL a,LL n){
if(a==) return b;
if(b==) return a;
if(!(a&)&&!(b&)) return *gcd(a>>,b>>);
else if(!(a&)) return gcd(a>>,b);
else if(!(b&)) return gcd(a,b>>);
else return gcd(aabs(a-b),min(a,b));
}

循环

inline int gcd(int a,int b){
while(b!=){int tmp=a%b;a=b;b=tmp;}return a;}

日后继续