結果

問題 No.467 隠されていたゲーム
ユーザー Vir_MeL0Vir_MeL0
提出日時 2017-03-22 02:52:16
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,357 bytes
コンパイル時間 2,177 ms
コンパイル使用メモリ 74,200 KB
実行使用メモリ 51,416 KB
最終ジャッジ日時 2023-09-18 19:32:53
合計ジャッジ時間 4,603 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
49,276 KB
testcase_01 AC 44 ms
49,360 KB
testcase_02 AC 44 ms
49,524 KB
testcase_03 AC 45 ms
49,408 KB
testcase_04 WA -
testcase_05 AC 45 ms
49,228 KB
testcase_06 AC 44 ms
49,404 KB
testcase_07 WA -
testcase_08 AC 44 ms
49,184 KB
testcase_09 WA -
testcase_10 AC 45 ms
49,604 KB
testcase_11 AC 45 ms
49,296 KB
testcase_12 AC 45 ms
49,308 KB
testcase_13 AC 45 ms
49,308 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 44 ms
49,340 KB
testcase_18 AC 46 ms
49,356 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 45 ms
49,508 KB
testcase_23 AC 45 ms
49,284 KB
testcase_24 AC 45 ms
49,372 KB
testcase_25 WA -
testcase_26 AC 45 ms
49,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int n = Integer.parseInt(str);
		str = br.readLine();
		String[] dstr = str.split(" ");
		int[] d = new int[n];
		for (int i = 0; i < n; i++)
			d[i] = Integer.parseInt(dstr[i]);
		str = br.readLine();
		String[] coordinate = str.split(" ");
		int x = Integer.parseInt(coordinate[0]);
		int y = Integer.parseInt(coordinate[1]);
		int dst = Math.max(x, y);
		int[] d_s = Sort(d);
		if (dst < d_s[n - 1])
			System.out.println("2");
		else if (dst <= d_s[0]) {
			boolean flag = false;
			for (int dist : d_s) {
				if (dst == dist) {
					System.out.println("1");
					flag = true;
					break;
				}
			}
			if (!flag)
				System.out.println("2");
		} else {
			if (dst % d_s[0] == 0)
				System.out.println(dst / d_s[0]);
			else
				System.out.println(dst / d_s[0] + 1);
		}

	}

	private static int[] Sort(int[] num) {
		int length = num.length;
		for (int i = 1; i < length - 1; i++) {
			for (int j = 0; j < length - i; j++) {
				if (num[j] < num[j + 1]) {
					int tmpnum = num[j];
					num[j] = num[j + 1];
					num[j + 1] = tmpnum;
				}
			}
		}
		return num;
	}
}
0