0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 23:08:47 +00:00
OI-codes/Codeforces/1606/B/B.cpp
2022-04-01 18:33:24 +08:00

25 lines
396 B
C++

#include <bits/stdc++.h>
using namespace std;
int t;
long long n, k, f, ans;
int main() {
cin >> t;
while (t--) {
f = 1;
ans = 0;
cin >> n >> k;
while (f <= k && f < n) {
ans++;
f <<= 1;
}
if (f < n) {
ans += (n - f) / k + !!((n - f) % k);
}
cout << ans << endl;
}
return 0;
}