結果

問題 No.70 睡眠の重要性!
ユーザー jimanojimano
提出日時 2018-01-26 23:43:39
言語 Java19
(openjdk 21)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 942 bytes
コンパイル時間 4,852 ms
コンパイル使用メモリ 73,452 KB
実行使用メモリ 49,440 KB
最終ジャッジ日時 2023-08-27 19:55:58
合計ジャッジ時間 6,182 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
49,200 KB
testcase_01 AC 40 ms
49,340 KB
testcase_02 AC 40 ms
49,432 KB
testcase_03 AC 40 ms
49,440 KB
testcase_04 AC 41 ms
49,372 KB
testcase_05 AC 39 ms
49,196 KB
権限があれば一括ダウンロードができます

ソースコード

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]) };

				// 分換算しちゃう
				int bed = bedtime[0] * 60 + bedtime[1];
				int wake = wakeuptime[0] * 60 + wakeuptime[1];
				if (bed > wake) {
					wake += 24 * 60;
				}
				sum += wake - bed;
			}
			System.out.println(sum);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0