0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-18 21:11:57 +00:00
OI-codes/CodeForces/1606/B/B.cpp

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;
}