結果
| 問題 |
No.467 隠されていたゲーム
|
| ユーザー |
id_kangaete
|
| 提出日時 | 2017-01-02 01:41:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1,315 ms / 2,000 ms |
| コード長 | 574 bytes |
| コンパイル時間 | 759 ms |
| コンパイル使用メモリ | 65,712 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-04 16:25:20 |
| 合計ジャッジ時間 | 2,933 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n,x,y,d,idx;
int S = 0; //回数
vector<int> v;
cin >> n;
while(n--){
int x;
cin >> x;
v.push_back(x);
}
cin >> x >> y;
d = max({abs(x),abs(y)});
sort(v.begin(),v.end());
idx = v.size()-1;
while(d!=0){
if(2*v[idx] < d){
S = S+1;
d = abs(d - v[idx]);
}
else if(find(v.begin(),v.end(),d)!=v.end()){
S = S + 1;
break;
}
else{
S = S + 2;
break;
}
}
cout << S << endl;
return 0;
}
id_kangaete