-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblema1160.java
More file actions
34 lines (27 loc) · 830 Bytes
/
Copy pathproblema1160.java
File metadata and controls
34 lines (27 loc) · 830 Bytes
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
package beeCrowd;
import java.util.Scanner;
public class problema1160 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int i = 0; i < T; i++) {
int PA = sc.nextInt();
int PB = sc.nextInt();
double G1 = sc.nextDouble();
double G2 = sc.nextDouble();
int anos = 0;
while (PA <= PB) {
PA += (int) (PA * G1 / 100);
PB += (int) (PB * G2 / 100);
anos++;
if (anos > 100) {
System.out.println("Mais de 1 seculo.");
break;
}
}
if (anos <= 100) {
System.out.println(anos + " anos.");
}
}
}
}