結果
| 問題 |
No.70 睡眠の重要性!
|
| コンテスト | |
| ユーザー |
harhogefoo
|
| 提出日時 | 2016-10-06 08:51:48 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 573 bytes |
| コンパイル時間 | 48 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-11-21 18:03:02 |
| 合計ジャッジ時間 | 1,058 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 1 |
コンパイルメッセージ
Syntax OK
ソースコード
n = gets.to_i
total_sleep_h, total_sleep_m = 0, 0
n.times do
sleep, wakeup = gets.chomp.split(" ")
sleep_h, sleep_m = sleep.chomp.split(":").map(&:to_i)
wakeup_h, wakeup_m = wakeup.chomp.split(":").map(&:to_i)
if sleep_h > wakeup_h
sleep_h = 23 - sleep_h
sleep_m = 60 - sleep_m
sleep_h += wakeup_h
sleep_m += wakeup_m
else
sleep_h = sleep_h + 1
sleep_m = 60 - sleep_m
sleep_h = wakeup_h - sleep_h
sleep_m += wakeup_m
end
total_sleep_h += sleep_h
total_sleep_m += sleep_m
end
puts "#{total_sleep_h * 60 + total_sleep_m}"
harhogefoo