結果

問題 No.70 睡眠の重要性!
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-26 21:40:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 1,127 bytes
コンパイル時間 3,962 ms
コンパイル使用メモリ 74,116 KB
実行使用メモリ 49,364 KB
最終ジャッジ日時 2023-10-11 14:05:29
合計ジャッジ時間 2,977 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,364 KB
testcase_01 AC 44 ms
49,276 KB
testcase_02 AC 43 ms
49,260 KB
testcase_03 AC 44 ms
49,080 KB
testcase_04 AC 44 ms
49,048 KB
testcase_05 AC 43 ms
49,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());

        int sum = 0;
        for (int i = 0; i < N; i++) {
            String[] inputs = reader.readLine().split(" ");
            String[] sleepTime = inputs[0].split(":");
            String[] wakeUpTime = inputs[1].split(":");
            int H1 = Integer.parseInt(sleepTime[0]);
            int M1 = Integer.parseInt(sleepTime[1]);
            int h1 = Integer.parseInt(wakeUpTime[0]);
            int m1 = Integer.parseInt(wakeUpTime[1]);
            int a = H1 * 60 + M1;
            int b = h1 * 60 + m1;
            if (a > b) {
                sum +=b - a + 1440;
            } else {
                sum += b-a;
            }

        }
        System.out.println(sum);
    }


}
0