-
Notifications
You must be signed in to change notification settings - Fork 0
/
URI_1047.cpp
48 lines (40 loc) · 903 Bytes
/
URI_1047.cpp
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
#include <iostream>
int main() {
int inih, inim, finh, finm;
int durh, durm;
std::cin>>inih>>inim>>finh>>finm;
if(inih == finh && inim == finm)
{
durh = 24;
durm = 0;
}
else
if(inih >= finh && inim > finm)
{
durh = (finh + 23) - inih;
durm = (finm + 60) - inim;
}
else
if(inih >= finh && inim <= finm)
{
durh = (finh + 24) - inih;
durm = finm - inim;
}
else
if(inih < finh && inim > finm)
{
durh = (finh - inih) - 1;
durm = (finm + 60) - inim;
}
else
if(inih < finh && inim <= finm)
{
durh = finh - inih;
durm = finm - inim;
}
if(durh == 24 && durm > 0)
durh = 0;
if(durh != 0 || durm != 0)
std::cout<<"O JOGO DUROU "<<durh<<" HORA(S) E "<<durm<<" MINUTO(S)\n";
return 0;
}