#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int N, M;
cin >> N;
vector<int>v;
for (int i = 0; i < N; i++) {
int number; cin >> number;
v.push_back(number);
}
sort(v.begin(), v.end());
int ans;
cin >> M;
for (int i = 0; i < M; i++) {
int target; cin >> target;
auto upper = upper_bound(v.begin(), v.end(), target);
auto lower = lower_bound(v.begin(), v.end(), target);
ans = upper - lower;
cout << ans << " ";
}
}
```
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 10819๋ฒ - ์ฐจ์ด๋ฅผ ์ต๋๋ก (0) | 2021.10.24 |
---|---|
[๋ฐฑ์ค,c++] 10818๋ฒ - ์ต์, ์ต๋ (0) | 2021.10.24 |
[๋ฐฑ์ค,c++] 10817๋ฒ - ์ธ ์ (0) | 2021.10.24 |
[๋ฐฑ์ค,c++] 10815๋ฒ - ์ซ์์นด๋ (0) | 2021.10.24 |
[๋ฐฑ์ค,c++] 10814๋ฒ - ๋์ด์ ์ ๋ ฌ (0) | 2021.10.24 |
[๋ฐฑ์ค,c++] 10811๋ฒ - ๋ฐ๊ตฌ๋ ๋ค์ง๊ธฐ (0) | 2021.10.24 |
๋๊ธ