-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2439.java
54 lines (43 loc) · 1.01 KB
/
2439.java
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
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* http://coj.uci.cu/24h/problem.xhtml?abb=2439
*
* Problem number: 2439
*
* @author Guido J. Celada ([email protected])
**/
public class Main {
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws Exception{
int n = Integer.parseInt(in.readLine());
String readed;
String[] readedArray;
int L;
int max;
double result;
int iteration;
for(int i = 0; i < n; i++){
readed = in.readLine();
readedArray = readed.split(" ");
L = Integer.parseInt(readedArray[0]);
max = Integer.parseInt(readedArray[1]);
result = -1;
iteration = 0;
double aux;
if(L <= max){
iteration++;
result = L;
while (result <= max){
aux = 1;
for(int j = 0; j < iteration; j++){
aux = aux/3;
}
result = (L * aux * Math.pow(5, iteration));
iteration++;
}
}
System.out.println(iteration-2);
}
}
}