結果

問題 No.70 睡眠の重要性!
コンテスト
ユーザー ondy_candy
提出日時 2016-07-23 09:02:15
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 159 ms / 5,000 ms
コード長 801 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 560 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 15,324 KB
最終ジャッジ日時 2026-05-06 19:37:00
合計ジャッジ時間 3,759 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# -*- 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