-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1047.cpp
More file actions
34 lines (23 loc) · 669 Bytes
/
1047.cpp
File metadata and controls
34 lines (23 loc) · 669 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
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
int hInicial, hFinal, mInicial, mFinal, horas, minutos, resultado;
cin >> hInicial >> mInicial >> hFinal >> mFinal;
hInicial = hInicial * 60 + mInicial;
hFinal = hFinal * 60 + mFinal;
if (hFinal > hInicial) {
resultado = hFinal - hInicial;
}
if (hFinal == hInicial) {
resultado = 1440;
}
if (hFinal < hInicial) {
resultado = abs(hInicial - 1440) + hFinal;
}
horas = resultado / 60;
minutos = resultado % 60;
cout << "O JOGO DUROU " << horas << " HORA(S) E " << minutos << " MINUTO(S)" << endl;
return 0;
}