-
Notifications
You must be signed in to change notification settings - Fork 0
/
1047.c
54 lines (53 loc) · 926 Bytes
/
1047.c
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
#include <stdio.h>
int main()
{
int H1, H2, M1, M2, M, H;
scanf("%d%d%d%d", &H1, &M1, &H2, &M2);
if((H1==M2) && (H2==M2) && (M2==M1))
{
M=M1-M2;
H=24+H1-H2;
}
else if((H1==H2) && (M2>M1))
{
M=M2-M1;
H=H1-H2;
}
else if((H1==H2) && (M1>M2))
{
M=60-M1+M2;
H=24-H1+H2-1;
}
else if((M1==M2) && (H1<H2))
{
M=0;
H=H2-H1;
}
else if((M1==M2) && (H1>H2))
{
M=0;
H=24-H1+H2;
}
else if((H2>H1) && (M2>M1))
{
M=M2-M1;
H=H2-H1;
}
else if((H1<H2) && (M1>M2))
{
M=60-M1+M2;
H=H2-H1-1;
}
else if((H1>H2) && (M1<M2))
{
M=M2-M1;
H=24-H1-1+H2;
}
else if((H1>H2) && (M1>M2))
{
M=60+M2-M1;
H=24+H2-H1-1;
}
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", H, M);
return 0;
}