結果

問題 No.467 隠されていたゲーム
ユーザー 37zigen
提出日時 2016-12-18 01:25:06
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 716 bytes
コンパイル時間 3,356 ms
コンパイル使用メモリ 77,720 KB
実行使用メモリ 54,352 KB
最終ジャッジ日時 2024-12-14 07:31:57
合計ジャッジ時間 8,025 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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