思路:直接照着题意模拟就可以了,但要注意一件事。

十年OI一场空

不开longlong见祖宗

其实题目给了提示,不会有人眼瞎看不见吧

#include <iostream>
#include <cmath>
using namespace std;

long long a, b;

int fj (long long x) {//求x的最高位
    int y;
    while (x != 0) {
        y = x % 10;
        x /= 10;
    }
    return y;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cin >> a >> b;
    for (int e = 0; e <= 62; e ++) {
        long long tmp = pow(2, e);
        if (e > a && fj (tmp) == b) {
            cout << e;
            return 0;
        }
    }
    cout << 0;
    return 0;
}