結果

問題 No.1236 長針と短針
ユーザー ks2mks2m
提出日時 2020-09-25 21:30:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 2,226 ms
コンパイル使用メモリ 72,132 KB
実行使用メモリ 49,804 KB
最終ジャッジ日時 2023-09-10 14:56:38
合計ジャッジ時間 4,119 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,804 KB
testcase_01 AC 43 ms
49,324 KB
testcase_02 AC 43 ms
49,168 KB
testcase_03 AC 44 ms
49,160 KB
testcase_04 AC 43 ms
49,264 KB
testcase_05 AC 43 ms
49,280 KB
testcase_06 AC 43 ms
49,464 KB
testcase_07 AC 43 ms
49,300 KB
testcase_08 AC 44 ms
49,648 KB
testcase_09 AC 43 ms
49,404 KB
testcase_10 AC 43 ms
49,404 KB
testcase_11 AC 44 ms
49,356 KB
testcase_12 AC 43 ms
49,712 KB
testcase_13 AC 43 ms
49,256 KB
testcase_14 AC 43 ms
49,448 KB
testcase_15 AC 43 ms
49,292 KB
testcase_16 AC 43 ms
47,196 KB
testcase_17 AC 44 ms
49,196 KB
testcase_18 AC 44 ms
49,292 KB
testcase_19 AC 44 ms
49,284 KB
testcase_20 AC 44 ms
49,652 KB
testcase_21 AC 44 ms
49,496 KB
testcase_22 AC 43 ms
49,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int a = Integer.parseInt(sa[0]);
		int b = Integer.parseInt(sa[1]);
		br.close();

		a %= 12;
		int x = 60 * 60 * 12;
		int[] y = new int[12];
		for (int i = 0; i < 12; i++) {
			y[i] = x * i / 11;
		}

		int ans = Integer.MAX_VALUE;
		int t = 3600 * a + 60 * b;
		for (int i = 0; i < 12; i++) {
			int d = y[i] - t;
			if (d >= 0) {
				ans = Math.min(ans, d);
			}
		}
		System.out.println(ans);
	}
}
0