Skip to content

Commit

Permalink
Solve Game Time with Minutes in python
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Jul 29, 2024
1 parent 1e801aa commit 9a62625
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions solutions/beecrowd/1047/1047.py
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)'
)

0 comments on commit 9a62625

Please sign in to comment.