結果

問題 No.70 睡眠の重要性!
ユーザー koukonkokoukonko
提出日時 2015-12-19 17:59:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 1,015 bytes
コンパイル時間 4,254 ms
コンパイル使用メモリ 73,736 KB
実行使用メモリ 49,480 KB
最終ジャッジ日時 2023-10-14 22:31:31
合計ジャッジ時間 4,959 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
49,480 KB
testcase_01 AC 46 ms
49,172 KB
testcase_02 AC 46 ms
49,232 KB
testcase_03 AC 47 ms
49,396 KB
testcase_04 AC 47 ms
49,176 KB
testcase_05 AC 44 ms
49,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

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

public class Main {
	public static void main(String[] args) {
		BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));

		try {
			int count = Integer.parseInt(buff.readLine());
			int ans = 0;
			while (count-- > 0) {
				String[] box = buff.readLine().split(" ");
				String[] goBox = box[0].split(":");
				String[] getBox = box[1].split(":");
				int go = 0;
				int get = 0;

				for (int i = 0; i < 2; ++i) {
					int mul = 1;
					if (i == 0) {
						mul = 60;
					}
					get += Integer.parseInt(getBox[i]) * mul;
					go += Integer.parseInt(goBox[i]) * mul;
				}
				if (get - go > 0) {
					ans += get - go;
				} else {
					ans += 24 * 60 - Math.abs(get - go);
				}
			}
			System.out.println(ans);

		} catch (NumberFormatException e) {
			e.getStackTrace();
		} catch (IOException e) {
			e.getStackTrace();
		} catch (Exception e) {
			e.getStackTrace();
		}
	}
}
0