結果

問題 No.467 隠されていたゲーム
ユーザー startcpp
提出日時 2016-12-19 15:50:48
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 56,460 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 16:19:47
合計ジャッジ時間 1,276 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int n;
int d[15];
int x, y;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> d[i];
	cin >> x >> y;
	if (x < 0) x = -x;
	if (y < 0) y = -y;

	int ans = 1145141919;
	for (int i = 0; i < n; i++) {
		int cnt;
		if (max(x, y) % d[i] == 0) {
			cnt = max(x, y) / d[i];
		}
		else if (max(x, y) < d[i]) {
			cnt = 2;
		}
		else {
			cnt = max(x, y) / d[i] + 1;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

//自信ない

0