結果

問題 No.467 隠されていたゲーム
ユーザー Vir_MeL0Vir_MeL0
提出日時 2017-03-22 03:05:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,042 bytes
コンパイル時間 2,104 ms
コンパイル使用メモリ 74,008 KB
実行使用メモリ 49,784 KB
最終ジャッジ日時 2023-09-19 05:29:50
合計ジャッジ時間 4,801 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
47,076 KB
testcase_01 AC 45 ms
49,376 KB
testcase_02 AC 45 ms
49,392 KB
testcase_03 AC 45 ms
49,204 KB
testcase_04 AC 44 ms
49,268 KB
testcase_05 AC 45 ms
47,336 KB
testcase_06 AC 46 ms
49,368 KB
testcase_07 AC 46 ms
49,332 KB
testcase_08 AC 45 ms
49,224 KB
testcase_09 WA -
testcase_10 AC 45 ms
49,084 KB
testcase_11 AC 45 ms
49,288 KB
testcase_12 AC 45 ms
49,264 KB
testcase_13 AC 45 ms
49,224 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 45 ms
49,392 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 44 ms
49,276 KB
testcase_24 AC 45 ms
49,312 KB
testcase_25 AC 45 ms
49,368 KB
testcase_26 AC 46 ms
49,268 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);
		if (dst < d[0])
			System.out.println("2");
		else if (dst <= d[n - 1]) {
			boolean flag = false;
			for (int dist : d) {
				if (dst == dist) {
					System.out.println("1");
					flag = true;
					break;
				}
			}
			if (!flag)
				System.out.println("2");
		} else {
			if (dst % d[n - 1] == 0)
				System.out.println(dst / d[n - 1]);
			else
				System.out.println(dst / d[n - 1] + 1);
		}

	}

}
0