-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solve Game Time with Minutes in python
- Loading branch information
1 parent
1e801aa
commit 9a62625
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import sys | ||
|
||
for line in sys.stdin: | ||
|
||
start_hours, start_minutes, end_hours, end_minutes = map(int, line.split()) | ||
|
||
if start_hours == end_hours and start_minutes == end_minutes: | ||
print('O JOGO DUROU 24 HORA(S) E 0 MINUTO(S)') | ||
continue | ||
|
||
durantion_hours = end_hours - start_hours | ||
if durantion_hours < 0: | ||
durantion_hours += 24 | ||
|
||
durantion_minutes = end_minutes - start_minutes | ||
if durantion_minutes < 0: | ||
durantion_minutes += 60 | ||
durantion_hours -= 1 | ||
|
||
if durantion_hours < 0: | ||
durantion_hours += 24 | ||
|
||
print( | ||
f'O JOGO DUROU {durantion_hours} HORA(S) E {durantion_minutes} MINUTO(S)' | ||
) |