-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP173PROF.cpp
More file actions
55 lines (48 loc) · 1.03 KB
/
P173PROF.cpp
File metadata and controls
55 lines (48 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<bits/stdc++.h>
using namespace std;
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Ford(i, a, b) for(int i = a; i >= b; i--)
#define ll long long
#define here cout<<"I am Here"<<endl;
int const maxn = 1000000;
int const base = 1e9 + 7;
int main(void){
int T;
cin>>T;
while(T--){
long long a, b;
cin>>a>>b;
long long Ar[4];
For(i, 1, 3)Ar[i] = b;
if(a == b){
cout<<"0"<<endl;
}
else{
long long res = 0;
if(2 * b - 1 >= a) cout<<"3"<<endl;
else{
long long x, y, z;
while(1){
Ar[1] = Ar[2] + Ar[3] - 1;
if(Ar[1] > a) break;
res++;
x = Ar[1];
Ar[2] = Ar[1] + Ar[3] - 1;
if(Ar[2] > a) break;
res++;
y = Ar[2];
Ar[3] = Ar[1] + Ar[2] - 1;
if(Ar[3] > a) break;
z = Ar[3];
res++;
}
res += 3;
if(x == a) res--;
if(y == a) res--;
if(z == a) res--;
cout<<res<<endl;
}
}
}
return 0;
}