結果

問題 No.70 睡眠の重要性!
ユーザー ondy_candyondy_candy
提出日時 2016-07-23 09:02:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 801 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-24 07:29:45
合計ジャッジ時間 805 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,880 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 29 ms
11,008 KB
testcase_03 AC 31 ms
11,008 KB
testcase_04 AC 27 ms
10,880 KB
testcase_05 AC 26 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
# n = int(input())
import datetime

today = datetime.datetime.now()
tomorrow = today + datetime.timedelta(days=1)

n = int(input())

seconds = 0
for i in range(n):
    s, e = [j for j in input().split()]
    sh, sm = [int(j) for j in s.split(":")]
    eh, em = [int(j) for j in e.split(":")]

    if datetime.time(sh, sm) <= datetime.time(eh, em):
        start = datetime.datetime(today.year, today.month, today.day, sh, sm, 0)
        end = datetime.datetime(today.year, today.month, today.day, eh, em, 0)
    else:
        start = datetime.datetime(today.year, today.month, today.day, sh, sm, 0)
        end = datetime.datetime(tomorrow.year, tomorrow.month, tomorrow.day, eh, em, 0)

    delta = end - start
    seconds += delta.total_seconds()

print( int(seconds / 60) )
0