結果

問題 No.70 睡眠の重要性!
ユーザー yagi2yagi2
提出日時 2017-04-25 16:12:10
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 921 bytes
コンパイル時間 3,241 ms
コンパイル使用メモリ 74,360 KB
実行使用メモリ 56,132 KB
最終ジャッジ日時 2023-10-11 09:38:13
合計ジャッジ時間 3,497 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,812 KB
testcase_01 AC 120 ms
56,016 KB
testcase_02 AC 121 ms
56,132 KB
testcase_03 AC 124 ms
55,852 KB
testcase_04 AC 124 ms
55,736 KB
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = Integer.parseInt(sc.next());

        int sumHour[] = {0};
        int sumMin[]  = {0};


        for (int i = 0; i < N; i++) {
            String G = sc.next();
            String W = sc.next();

            int Gh = Integer.parseInt(G.split(":")[0]);
            int Gm = Integer.parseInt(G.split(":")[1]);
            int Wh = Integer.parseInt(W.split(":")[0]);
            int Wm = Integer.parseInt(W.split(":")[1]);

            if (Wh - Gh < 0) {
                sumHour[0] += ((24 - Gh) + Wh) - 1;
            } else {
                sumHour[0] += Wh - Gh - 1;
            }
            sumMin[0] += 60 - Gm + Wm;

            sumHour[0] += sumMin[0] / 60;
            sumMin[0] %= 60;
        }
        System.out.println(sumHour[0]*60 + sumMin[0]);
    }
}
0