pesquisa

URI PROBLEMA URI 1046 - Tempo de Jogo SOLUÇÃO EM PYTHON

URI Online Judge | 1046

Tempo de Jogo

Adaptado por Neilor Tonin, URI  Brasil
Timelimit: 1
Leia a hora inicial e a hora final de um jogo. A seguir calcule a duração do jogo, sabendo que o mesmo pode começar em um dia e terminar em outro, tendo uma duração mínima de 1 hora e máxima de 24 horas.

Entrada

A entrada contém dois valores inteiros representando a hora de início e a hora de fim do jogo.

Saída

Apresente a duração do jogo conforme exemplo abaixo.



URI Online Judge | 1046

Game Time

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Read the start time and end time of a game, in hours. Then calculate the duration of the game, knowing that the game can begin in a day and finish in another day, with a maximum duration of 24 hours. The message must be printed in portuguese “O JOGO DUROU X HORA(S)” that means “THE GAME LASTED X HOUR(S)”

Input

Two integer numbers representing the start and end time of a game.

Output

Print the duration of the game as in the sample output.




x = input().split()
i, f = x

i = int(x[0])
f = int(x[1])

if i < f:
    t = f - i
else:
    t = (24 - i) + f
print('O JOGO DUROU {} HORA(S)'.format(t))

Postar um comentário

0 Comentários