結果

問題 No.70 睡眠の重要性!
ユーザー Hiroaki Kono
提出日時 2017-10-31 22:33:08
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 733 bytes
コンパイル時間 3,393 ms
コンパイル使用メモリ 74,380 KB
実行使用メモリ 41,508 KB
最終ジャッジ日時 2024-11-22 11:14:22
合計ジャッジ時間 4,786 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No70 {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int count = s.nextInt();
        int minutes = 0;
        for (int i = 0; i < count; i++) {
            String[] sleep = s.next().split(":");
            String[] wakeup = s.next().split(":");
            int wakeupHour = Integer.parseInt(wakeup[0]);
            int sleepHour = Integer.parseInt(sleep[0]);
            if (sleepHour > wakeupHour) {
                wakeupHour += 24;
            }
            minutes += (wakeupHour - sleepHour) * 60
                       + Integer.parseInt(wakeup[1]) - Integer.parseInt(sleep[1]);
        }
        System.out.println(minutes);
    }
}
0