結果

問題 No.70 睡眠の重要性!
ユーザー abcabc
提出日時 2016-11-02 01:24:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 923 bytes
コンパイル時間 3,707 ms
コンパイル使用メモリ 71,912 KB
実行使用メモリ 55,968 KB
最終ジャッジ日時 2023-08-16 12:32:51
合計ジャッジ時間 3,543 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,932 KB
testcase_01 AC 121 ms
55,700 KB
testcase_02 AC 122 ms
55,604 KB
testcase_03 AC 125 ms
55,660 KB
testcase_04 AC 126 ms
55,564 KB
testcase_05 AC 120 ms
55,968 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