結果

問題 No.70 睡眠の重要性!
ユーザー ksomemoksomemo
提出日時 2017-10-05 23:14:30
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 551 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 10,636 KB
実行使用メモリ 7,968 KB
最終ジャッジ日時 2023-08-10 14:53:57
合計ジャッジ時間 783 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

def main():
    N = int(input())

    ans = 0
    for _ in range(N):
        st, end = input().split()
        st_h, st_m = map(int, st.split(":"))
        end_h, end_m = map(int, end.split(":"))

        h = end_h - st_h
        m = end_m - st_m
        if m < 0:
            # add: WA対応
            # こちらを先に処理しないと23:59睡眠の考慮漏れ
            # 0:1 0:0
            h -= 1
            m += 60
        if h < 0:
            h += 24

        ans += h * 60 + m

    print(ans)

if __name__ == '__main__':
    main()
0