結果
| 問題 | No.467 隠されていたゲーム |
| コンテスト | |
| ユーザー |
mogurocker
|
| 提出日時 | 2017-10-17 16:57:51 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 869 bytes |
| 記録 | |
| コンパイル時間 | 1,069 ms |
| コンパイル使用メモリ | 159,628 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-17 21:58:22 |
| 合計ジャッジ時間 | 1,719 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;
int n, x, y, d[20];
int main(int argc, char const *argv[]) {
ios_base::sync_with_stdio(false);
cin >> n;
FOR(i, n) cin >> d[i];
cin >> x >> y;
if (x < y) swap(x, y);
int ma = *max_element(d, d+n);
int ret = x/ma;
int _x = x % ma;
if (_x == 0) {
cout << ret << endl;
return 0;
}
FOR(i, n) {
if (_x % d[i] == 0) {
cout << ret+1 << endl;
return 0;
}
}
_x += ma;
FOR(i, n) FOR(j, n) {
bool ok = false;
if (_x == d[i]+d[j]) ok = true;
if (_x == abs(d[i]-d[j])) ok = true;
if (ok) {
cout << ret+1 << endl;
return 0;
}
}
cout << ret+2 << endl;
return 0;
}
mogurocker