結果
問題 | No.467 隠されていたゲーム |
ユーザー |
![]() |
提出日時 | 2017-03-20 21:13:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 671 ms |
コンパイル使用メモリ | 76,940 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-04 16:28:02 |
合計ジャッジ時間 | 1,556 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <iostream> #include <vector> #include <cmath> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector<int> d(n); int max_d = 0; for(int i=0; i<n; ++i) { cin >> d[i]; max_d = max(d[i], max_d); } int x, y; cin >> x >> y; x = abs(x), y = abs(y); if(x == 0 && y == 0) { cout << 0 << endl; } else if(find(d.begin(), d.end(), max(x, y)) != d.end()) { cout << 1 << endl; } else if(max(x, y) < max_d) { cout << 2 << endl; } else { cout << (max(x, y) + max_d - 1) / max_d << endl; } }