結果

問題 No.70 睡眠の重要性!
ユーザー ymgckyoymgckyo
提出日時 2017-11-04 21:09:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 575 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 7,920 KB
最終ジャッジ日時 2023-08-15 17:10:30
合計ジャッジ時間 765 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,768 KB
testcase_01 AC 15 ms
7,856 KB
testcase_02 AC 16 ms
7,824 KB
testcase_03 AC 15 ms
7,784 KB
testcase_04 AC 15 ms
7,756 KB
testcase_05 AC 15 ms
7,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
input_list = []

for i in range(n):
    input_list.append(list(input().split()))

amount = 0
for e in input_list:
    down_h, down_m = map(int, str(e[0]).split(':'))
    up_h, up_m = map(int, str(e[1]).split(':'))

    sleep_m = up_m - down_m
    sleep_h = up_h - down_h

    if sleep_h == 0 and sleep_m < 0:
        sleep_h += 24

    if sleep_h < 0:
        sleep_h += 24

    if sleep_m < 0:
        sleep_h -= 1
        sleep_m += 60

    if sleep_m >= 60:
        sleep_h += 1
        sleep_m -= 60

    amount += (sleep_h * 60) + sleep_m

print(amount)
0