結果

問題 No.70 睡眠の重要性!
ユーザー dazydazy
提出日時 2016-09-09 01:35:08
言語 Java19
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 769 bytes
コンパイル時間 3,236 ms
コンパイル使用メモリ 71,528 KB
実行使用メモリ 55,960 KB
最終ジャッジ日時 2023-08-10 00:20:22
合計ジャッジ時間 4,604 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,960 KB
testcase_01 AC 125 ms
55,832 KB
testcase_02 AC 127 ms
55,588 KB
testcase_03 AC 131 ms
55,792 KB
testcase_04 AC 133 ms
55,660 KB
testcase_05 AC 122 ms
55,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        scan.useDelimiter("[^0-9]");
        int N = scan.nextInt();
        if (N < 1||N > 30) System.exit(1);
        int msum = 0;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            int H = scan.nextInt();
            int M = scan.nextInt();
            int h = scan.nextInt();
            int m = scan.nextInt();
            msum = m - M;
            if (msum > 59) {
                h++;
                msum -= 60;
            } else if (msum < 0) {
                h--;
                msum += 60;
            }
            ans += (h - H + 24)%24 * 60 + msum;
        }
        System.out.println(ans);
    }
}
0