結果

問題 No.467 隠されていたゲーム
ユーザー GrenacheGrenache
提出日時 2016-12-18 11:38:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 980 bytes
コンパイル時間 3,647 ms
コンパイル使用メモリ 78,248 KB
実行使用メモリ 54,464 KB
最終ジャッジ日時 2024-04-15 04:42:52
合計ジャッジ時間 7,196 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
53,992 KB
testcase_01 AC 119 ms
54,268 KB
testcase_02 AC 104 ms
53,012 KB
testcase_03 AC 116 ms
54,228 KB
testcase_04 AC 108 ms
52,964 KB
testcase_05 AC 122 ms
53,980 KB
testcase_06 AC 118 ms
54,048 KB
testcase_07 AC 111 ms
53,200 KB
testcase_08 AC 113 ms
53,492 KB
testcase_09 AC 121 ms
53,948 KB
testcase_10 AC 120 ms
54,060 KB
testcase_11 AC 121 ms
54,148 KB
testcase_12 AC 124 ms
54,204 KB
testcase_13 AC 125 ms
53,876 KB
testcase_14 AC 122 ms
54,116 KB
testcase_15 AC 119 ms
54,076 KB
testcase_16 AC 120 ms
53,124 KB
testcase_17 AC 107 ms
52,860 KB
testcase_18 AC 123 ms
54,404 KB
testcase_19 AC 124 ms
54,464 KB
testcase_20 AC 121 ms
54,292 KB
testcase_21 AC 131 ms
54,252 KB
testcase_22 AC 132 ms
54,456 KB
testcase_23 AC 109 ms
52,828 KB
testcase_24 AC 119 ms
54,168 KB
testcase_25 AC 119 ms
54,336 KB
testcase_26 AC 118 ms
53,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder467_1 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = sc.nextInt();
		}
		Arrays.sort(d);
		int maxd = d[n - 1];

		int x = Math.abs(sc.nextInt());
		int y = Math.abs(sc.nextInt());
		int maxx = Math.max(x, y);

		if (maxx == 0) {
			pr.println(0);
			return;
		}

		for (int e : d) {
			if (e == maxx) {
				pr.println(1);
				return;
			}
		}

		if (maxx % maxd == 0) {
			pr.println(maxx / maxd);
		} else {
			pr.println(Math.max(0, maxx / maxd - 1) + 2);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0