結果

問題 No.467 隠されていたゲーム
ユーザー 37zigen37zigen
提出日時 2016-12-18 01:25:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 716 bytes
コンパイル時間 3,857 ms
コンパイル使用メモリ 77,980 KB
実行使用メモリ 41,712 KB
最終ジャッジ日時 2024-05-08 06:05:52
合計ジャッジ時間 7,097 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
41,336 KB
testcase_01 AC 110 ms
41,220 KB
testcase_02 AC 111 ms
40,272 KB
testcase_03 AC 117 ms
41,408 KB
testcase_04 AC 112 ms
40,200 KB
testcase_05 AC 103 ms
40,056 KB
testcase_06 AC 114 ms
41,464 KB
testcase_07 AC 124 ms
41,276 KB
testcase_08 AC 113 ms
41,136 KB
testcase_09 WA -
testcase_10 AC 112 ms
41,252 KB
testcase_11 AC 113 ms
41,232 KB
testcase_12 AC 112 ms
41,124 KB
testcase_13 AC 114 ms
40,952 KB
testcase_14 AC 109 ms
41,176 KB
testcase_15 AC 106 ms
40,408 KB
testcase_16 AC 106 ms
40,132 KB
testcase_17 AC 117 ms
39,948 KB
testcase_18 AC 121 ms
41,432 KB
testcase_19 AC 120 ms
41,240 KB
testcase_20 AC 119 ms
41,528 KB
testcase_21 AC 115 ms
41,112 KB
testcase_22 AC 116 ms
41,140 KB
testcase_23 AC 115 ms
41,420 KB
testcase_24 AC 120 ms
41,356 KB
testcase_25 AC 106 ms
40,376 KB
testcase_26 AC 117 ms
41,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.*;

public class Q467 {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] d = new long[n];
		for (int i = 0; i < n; ++i) {
			d[i] = sc.nextLong();
		}
		long x = sc.nextLong();
		long y = sc.nextLong();
		x = Math.abs(x);
		y = Math.abs(y);
		Arrays.sort(d);
		long ans = 0;
		if (Math.max(x, y) > 2 * d[n - 1]) {
			long c = Math.max(x / d[n - 1], y / d[n - 1]);
			x = Math.max(0, x - d[n - 1] * (c - 1));
			y = Math.max(0, y - d[n - 1] * (c - 1));
			ans += c - 1;
		}
		ans += 2;
		for (int i = 0; i < n; ++i) {
			if (Math.max(x, y) == d[i]) {
				--ans;
				break;
			}
		}
		System.out.println(ans);
	}
}
0