結果

問題 No.70 睡眠の重要性!
ユーザー jimanojimano
提出日時 2018-01-26 23:26:59
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,012 bytes
コンパイル時間 3,324 ms
コンパイル使用メモリ 73,620 KB
実行使用メモリ 49,708 KB
最終ジャッジ日時 2023-08-27 19:54:02
合計ジャッジ時間 3,727 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
49,236 KB
testcase_01 AC 42 ms
49,708 KB
testcase_02 AC 42 ms
49,464 KB
testcase_03 AC 44 ms
49,288 KB
testcase_04 AC 41 ms
49,392 KB
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 h = 0, m = 0;
			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;
				}
				h += wakeuptime[0] - bedtime[0];
				m += wakeuptime[1] - bedtime[1];
			}
			System.out.println(h * 60 + m);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0