結果

問題 No.467 隠されていたゲーム
ユーザー Vir_MeL0Vir_MeL0
提出日時 2017-03-22 02:59:31
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,485 bytes
コンパイル時間 2,718 ms
コンパイル使用メモリ 73,564 KB
実行使用メモリ 51,488 KB
最終ジャッジ日時 2023-09-18 19:33:59
合計ジャッジ時間 4,273 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,304 KB
testcase_01 AC 44 ms
49,084 KB
testcase_02 RE -
testcase_03 AC 44 ms
49,148 KB
testcase_04 AC 44 ms
49,268 KB
testcase_05 RE -
testcase_06 WA -
testcase_07 WA -
testcase_08 RE -
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 44 ms
49,164 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 44 ms
49,216 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 45 ms
49,456 KB
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

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;
		if (length == 2 || num[0] < num[1]) {
			int tmpnum = num[0];
			num[0] = num[1];
			num[1] = tmpnum;
		} else {
			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