반응형
ACMICPC 1920 : 수 찾기
<결과>
<코드>
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { vector<int> vec_array; int num_array, num_finds; cin >> num_array; for (int i = 0; i < num_array; ++i) { int in_temp = 0; cin >> in_temp; vec_array.push_back(in_temp); } sort(vec_array.begin(), vec_array.end()); cin >> num_finds; for (int i = 0; i < num_finds; ++i) { int in_value; cin >> in_value; if (binary_search(vec_array.begin(), vec_array.end(), in_value)) cout << "1" << endl; else cout << "0" << endl; } return 0; }
반응형