結果

問題 No.70 睡眠の重要性!
ユーザー abcabc
提出日時 2016-11-02 01:24:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 923 bytes
コンパイル時間 1,773 ms
コンパイル使用メモリ 74,588 KB
実行使用メモリ 54,136 KB
最終ジャッジ日時 2024-05-03 20:58:43
合計ジャッジ時間 3,013 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
54,136 KB
testcase_01 AC 114 ms
53,656 KB
testcase_02 AC 127 ms
53,940 KB
testcase_03 AC 122 ms
54,068 KB
testcase_04 AC 107 ms
52,548 KB
testcase_05 AC 120 ms
54,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int TWENTY_FOUR_HOURS = 24 * 60;

        int n = sc.nextInt();

        int sleepTimeTotal = 0;

        for (int i = 0; i < n; i++) {

            String[] time = sc.next().split(":");
            int hourGoBedTime = Integer.parseInt(time[0]);
            int minuteGoBedTime = Integer.parseInt(time[1]);

            time = sc.next().split(":");
            int hourWakeUpTime = Integer.parseInt(time[0]);
            int minuteWakeUpTime = Integer.parseInt(time[1]);

            int goBedTime = (hourGoBedTime * 60)  + minuteGoBedTime;
            int wakeupTime = (hourWakeUpTime * 60) + minuteWakeUpTime;

            sleepTimeTotal += (wakeupTime - goBedTime + TWENTY_FOUR_HOURS) % TWENTY_FOUR_HOURS;

        }

        System.out.println(sleepTimeTotal);

    }

}
0