結果

問題 No.70 睡眠の重要性!
ユーザー dazy
提出日時 2016-09-09 01:35:08
言語 Java
(openjdk 23)
結果
AC  
実行時間 140 ms / 5,000 ms
コード長 769 bytes
コンパイル時間 3,296 ms
コンパイル使用メモリ 74,224 KB
実行使用メモリ 54,072 KB
最終ジャッジ日時 2024-11-15 22:55:58
合計ジャッジ時間 4,674 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

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