結果

問題 No.70 睡眠の重要性!
ユーザー mitsuomitsuo
提出日時 2016-05-04 13:31:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 5,000 ms
コード長 959 bytes
コンパイル時間 2,614 ms
コンパイル使用メモリ 79,456 KB
実行使用メモリ 41,940 KB
最終ジャッジ日時 2024-04-15 11:16:52
合計ジャッジ時間 3,785 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
41,716 KB
testcase_01 AC 142 ms
41,372 KB
testcase_02 AC 141 ms
41,584 KB
testcase_03 AC 146 ms
41,940 KB
testcase_04 AC 141 ms
41,564 KB
testcase_05 AC 136 ms
41,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] input = new String[31];
		int i = 0;
		while (sc.hasNext()) {
			input[i] = sc.nextLine();
			i++;
		}

		System.out.println(solve(input));

		sc.close();
	}

	public static long solve(String[] in) {
		int m = Integer.valueOf(in[0]);
		long ans = 0;
		for (int i = 1; i <= m; i++) {
			String[] s = in[i].split(" ");
			int sh = Integer.valueOf(s[0].split(":")[0]);
			int sm = Integer.valueOf(s[0].split(":")[1]);
			int eh = Integer.valueOf(s[1].split(":")[0]);
			int em = Integer.valueOf(s[1].split(":")[1]);
			LocalDateTime start = LocalDateTime.of(2016, 1, 1, sh, sm, 0, 0);
			LocalDateTime end = LocalDateTime.of(2016, 1, 2, eh, em, 0, 0);
			long d = ChronoUnit.MINUTES.between(start, end);
			ans += d % (60 * 24);
		}
		return ans;
	}
}
0