forked from MiYazJE/Acepta-el-reto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
p112.java
41 lines (29 loc) · 1.06 KB
/
p112.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
import java.util.Scanner;
public class p112 {
static int ONE_HOUR = 3600;
static int ONE_KILOMETTER = 1000;
public static void main(String[] args) {
final Scanner s = new Scanner(System.in);
double metters, maxTime, timeSeconds, medianTime, km, timeHours;
while (true) {
metters = s.nextInt();
maxTime = s.nextInt();
timeSeconds = s.nextInt();
if (metters == 0 && maxTime == 0 && timeSeconds == 0)
break;
km = metters / ONE_KILOMETTER;
timeHours = timeSeconds / ONE_HOUR;
medianTime = km / timeHours;
if (metters <= 0 || maxTime <= 0 || timeSeconds <= 0)
System.out.println("ERROR");
else if (medianTime < maxTime)
System.out.println("OK");
else
System.out.println(
((medianTime - maxTime) < (0.2 * maxTime))
? "MULTA"
: "PUNTOS"
);
}
}
}