結果

問題 No.70 睡眠の重要性!
ユーザー jimanojimano
提出日時 2018-01-26 23:38:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 992 bytes
コンパイル時間 4,353 ms
コンパイル使用メモリ 73,632 KB
実行使用メモリ 49,872 KB
最終ジャッジ日時 2023-08-27 19:55:12
合計ジャッジ時間 5,161 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No0070 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			int cnt = Integer.parseInt(br.readLine());
			int sum = 0;

			for (int i = 0; i < cnt; i++) {
				String[] input = br.readLine().split(" ");
				String[] str1 = input[0].split(":");
				String[] str2 = input[1].split(":");
				int[] bedtime = { Integer.parseInt(str1[0]), Integer.parseInt(str1[1]) };
				int[] wakeuptime = { Integer.parseInt(str2[0]), Integer.parseInt(str2[1]) };

				if (bedtime[0] > wakeuptime[0]) {
					wakeuptime[0] += 24;
				}
				if (bedtime[1] > wakeuptime[1]) {
					wakeuptime[1] += 60;
					wakeuptime[0] -= 1;
				}
				sum += (bedtime[0] * 60 + bedtime[1]) - (wakeuptime[0] * 60 + wakeuptime[1]);
			}
			System.out.println(sum);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0