mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-05 13:38:47 +00:00
25 lines
396 B
C++
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;
|
|
}
|