結果

問題 No.70 睡眠の重要性!
ユーザー Hiroaki KonoHiroaki Kono
提出日時 2017-10-31 22:37:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 855 bytes
コンパイル時間 3,172 ms
コンパイル使用メモリ 72,400 KB
実行使用メモリ 39,952 KB
最終ジャッジ日時 2023-08-14 13:37:50
合計ジャッジ時間 4,599 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
39,020 KB
testcase_01 AC 118 ms
39,232 KB
testcase_02 AC 120 ms
39,552 KB
testcase_03 AC 128 ms
39,252 KB
testcase_04 AC 125 ms
39,284 KB
testcase_05 AC 117 ms
39,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No70 {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int count = s.nextInt();
        int minutes = 0;
        for (int i = 0; i < count; i++) {
            String[] sleep = s.next().split(":");
            String[] wakeup = s.next().split(":");
            int sleepHour = Integer.parseInt(sleep[0]);
            int wakeupHour = Integer.parseInt(wakeup[0]);
            int sleepMinute = Integer.parseInt(sleep[1]);
            int wakeupMinute = Integer.parseInt(wakeup[1]);
            if (sleepHour > wakeupHour || sleepHour == wakeupHour && sleepMinute > wakeupMinute) {
                wakeupHour += 24;
            }
            minutes += (wakeupHour - sleepHour) * 60 + wakeupMinute - sleepMinute;
        }
        System.out.println(minutes);
    }
}
0