結果

問題 No.70 睡眠の重要性!
ユーザー jimano
提出日時 2018-01-26 23:26:59
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,012 bytes
コンパイル時間 3,797 ms
コンパイル使用メモリ 77,500 KB
実行使用メモリ 50,132 KB
最終ジャッジ日時 2024-12-28 02:13:23
合計ジャッジ時間 4,787 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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