forked from gmendonca/uri-problem-solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1047.cpp
More file actions
31 lines (24 loc) · 740 Bytes
/
1047.cpp
File metadata and controls
31 lines (24 loc) · 740 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
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int a, b, c, d;
cin >> a;
cin >> b;
cin >> c;
cin >> d;
int inicio = a*60 + b;
int final = c*60 + d;
int duracao = 0;
if(a <= c){
duracao = final - inicio;
if(duracao == 0)
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n",24,duracao%60);
else
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n",(duracao - duracao%60)/60,duracao%60);
}else{
duracao = (24*60 - inicio) + final;
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n",(duracao - duracao%60)/60,duracao%60);
}
return 0;
}