結果

問題 No.70 睡眠の重要性!
ユーザー gemmarogemmaro
提出日時 2019-10-12 07:19:05
言語 Ruby
(3.3.0)
結果
AC  
実行時間 93 ms / 5,000 ms
コード長 460 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-05-05 10:20:46
合計ジャッジ時間 1,553 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
12,288 KB
testcase_01 AC 93 ms
12,160 KB
testcase_02 AC 91 ms
12,160 KB
testcase_03 AC 88 ms
12,160 KB
testcase_04 AC 90 ms
12,288 KB
testcase_05 AC 91 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i    
sum = 0
n.times {
    line = gets.chomp.split
    begin_h, begin_m = line[0].split(':').map &:to_i
    end_h, end_m = line[1].split(':').map &:to_i
    if begin_h > end_h
        begin_h -= 24
    elsif begin_h == end_h
        if begin_m > end_m
            begin_m -= 24 * 60
        end
    end
    minute_begin = begin_h * 60 + begin_m
    minute_end = end_h * 60 + end_m
    time = minute_end - minute_begin
    sum += time
}
p sum
0