結果

問題 No.70 睡眠の重要性!
ユーザー @abcde@abcde
提出日時 2019-02-06 23:37:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 993 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 11,000 KB
実行使用メモリ 8,896 KB
最終ジャッジ日時 2023-09-05 08:20:41
合計ジャッジ時間 1,294 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,860 KB
testcase_01 AC 19 ms
8,724 KB
testcase_02 AC 19 ms
8,808 KB
testcase_03 AC 19 ms
8,896 KB
testcase_04 AC 19 ms
8,700 KB
testcase_05 AC 19 ms
8,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
import datetime

# 1. 入力情報取得.
N = int(input())
ans = 0
for i in range(N):
    I = input()
    I = I.split()
    # print(I)
    
    # 寝た時刻(D日H時M分)
    D = 1
    H = int(I[0].split(":")[0])
    M = int(I[0].split(":")[1])
    
    # 起きた時刻(d日h時m分)
    d = 1
    h = int(I[1].split(":")[0])
    m = int(I[1].split(":")[1])
    # print("D=" + str(D) + " H=" + str(H) + " M=" + str(M) + " d=" + str(d) + " h=" + str(h) + " m=" + str(m))
    
    # 2. 日付データと見て差分を計算.
    # pythonで日時の差分を秒単位で出す方法.
    # https://qiita.com/puriketu99/items/568befc13510ee4d587f
    if H > h: d += 1
    if H == h and M > m: d += 1 # ex. 23:59 23:58 のようなデータが来た時に必要!
    fTime = datetime.datetime(2019, 2, D, H, M, 0)
    lTime = datetime.datetime(2019, 2, d, h, m, 0)
    delta = (lTime - fTime).total_seconds() / 60.0
    ans = ans + int(delta)

# 3. 出力.
print(ans)
0