solution.cpp 433 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include <bits/stdc++.h>
using namespace std;
long pow_2(int b)
{
    long x = 2;
    long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = x;
        b >>= 1;
        x = x * x;
    }
    return res;
}
int gcd(long a, long b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    cout << gcd(pow_2(20) - 1, pow_2(19)) << endl;
    cout << pow_2(20) - 1 << "/" << pow_2(19) << endl;
}