---
layout: post
title:  "[BOJ] 1920. 수 찾기"
categories: Algorithm
tags: BOJ
author: goodGid
---
* content
{:toc}

## Problem

Problem URL : **[수 찾기](https://www.acmicpc.net/problem/1920)**












![](/assets/img/algorithm/1920_1.png)

![](/assets/img/algorithm/1920_2.png)

---


## [1] Answer Code (18. 09. 26)

``` cpp
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    vector<int> v;
    int n;
    cin >> n;
    while (n--) {
        int tmp;
        cin >> tmp;
        v.push_back(tmp);
    }
    sort(v.begin(), v.end());
    
    cin >> n;
    while (n--) {
        int tmp;
        cin >> tmp;
        if(binary_search(v.begin(), v.end(), tmp))
            cout << "1" << '\n';
        else
            cout << "0" << '\n';
    }
    
    return 0;
}
```

### Review

* **endl**을 사용하니까 시간 초과가 떴다. 
Write BOJ Post " 1920. 수 찾기"
Write BOJ Post " 1920.  수 찾기"
