結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
49,472 KB
testcase_01 AC 46 ms
49,384 KB
testcase_02 AC 47 ms
49,336 KB
testcase_03 AC 47 ms
49,376 KB
testcase_04 AC 47 ms
49,400 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 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 += (wakeuptime[0] * 60 + wakeuptime[1]) - (bedtime[0] * 60 + bedtime[1]);
			}
			System.out.println(sum);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0