結果

問題 No.70 睡眠の重要性!
ユーザー turner18_jpturner18_jp
提出日時 2017-12-15 00:53:41
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 604 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2023-08-21 05:06:29
合計ジャッジ時間 806 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

n = int(input())
total = 0
w_all = 0
s_all = 0
for i in range(n):
  s, w = input().split()
  s_h, s_m= map(int, s.split(':'))
  w_h, w_m= map(int, w.split(':'))

  if len(str(s_h)) == 2 and len(str(w_h)) <= 1:
    w_all = int(w_h) * 60 + 1440 + int(w_m)
    s_all = int(s_h) * 60 + int(s_m)
  elif s_h == 0 and w_h == 0 and s_m <= w_m:
    w_all = w_m - s_m
  elif s_h == 0 and w_h == 0 and s_m >= w_m:
    w_all = 1440 - s_m
  elif len(str(s_h)) <= 1 and len(str(w_h)) <= 1:
    w_all = int(w_h) * 60 + 1440 + int(w_m)
    s_all = int(s_h) * 60 + 1440 + int(s_m)
  total += w_all - s_all

print(total)

0