TLE
查看原帖
TLE
713602
oldnet楼主2025/1/12 13:55
#include <bits/stdc++.h>
using namespace std;
long long a, b;
long long ans = INT_MAX;
int main()
{
    ios_base::sync_with_stdio(true);
    cin.tie(0);
    cout.tie(0);
    cin >> a >> b;
    for (long long i = 0;; i++)
    {
        long long A = a * (1 << i);
        long long d = abs(A - b);
        long long sum = i + d;
        if (sum < ans)
        {
            ans = sum;
        }
        if (A > 2 * b)
        {
            break;
        }
    }
    cout << ans;
    return 0;
}

96分求调,谢谢

2025/1/12 13:55
加载中...