gcd的各种写法
1.
ll gcd(ll a, ll b) { while(b^=a^=b^=a%=b); return a; }
2.
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; //前面在判断b是否等于0 }
//
int gcd(int a, int b)
{
return b == 0 ? a : gcd(b, a%b);
}
3.
int gcd(int x, int y) { int r = x % y; while(r) { x = y; y = r; r = x % y; } return y; }
时光花火,水月星辰