結果

問題 No.70 睡眠の重要性!
ユーザー gemmarogemmaro
提出日時 2019-10-12 07:19:05
言語 Ruby
(3.3.0)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 460 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 11,524 KB
実行使用メモリ 15,328 KB
最終ジャッジ日時 2023-08-18 03:51:46
合計ジャッジ時間 1,738 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,144 KB
testcase_01 AC 80 ms
15,024 KB
testcase_02 AC 81 ms
15,328 KB
testcase_03 AC 80 ms
15,140 KB
testcase_04 AC 81 ms
15,148 KB
testcase_05 AC 79 ms
15,076 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