Skip to content

欧几里得求GCD $ O(logN) $ ​

cpp
int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}