-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathURI_1047.java
More file actions
40 lines (28 loc) · 821 Bytes
/
URI_1047.java
File metadata and controls
40 lines (28 loc) · 821 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
35
36
37
38
39
40
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int start_h, end_h, start_m, end_m, duration_h, duration_m;
Scanner sc = new Scanner(System.in);
start_h = sc.nextInt();
start_m = sc.nextInt();
end_h = sc.nextInt();
end_m = sc.nextInt();
duration_h = end_h - start_h;
if (duration_h < 0)
{
duration_h = 24 + (end_h - start_h);
}
duration_m = end_m - start_m;
if (duration_m < 0)
{
duration_m = 60 + (end_m - start_m);
duration_h--;
}
if (start_h == end_h && start_m == end_m)
{
System.out.printf("O JOGO DUROU 24 HORA(S) E 0 MINUTO(S)\n");
}
else
System.out.printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", duration_h, duration_m);
}
}