Skip to content

Commit 216f9f8

Browse files
committed
[ADD] BOJ 2776 암기왕
- 자료구조
1 parent 054ed50 commit 216f9f8

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

acmicpc.net/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@
742742
| 47 | [안정적인 문자열](https://www.acmicpc.net/problem/4889) | [cpp](source/4889.cpp) | 48 | [서로 다른 부분 문자열의 개수](https://www.acmicpc.net/problem/11478) | [cpp](source/11478.cpp) |
743743
| 49 | [평행선](https://www.acmicpc.net/problem/2358) | [cpp](source/2358.cpp) | 50 | [괄호 끼워넣기](https://www.acmicpc.net/problem/11899) | [cpp](source/11899.cpp) |
744744
| 51 | [천재 수학자 성필](https://www.acmicpc.net/problem/15815) | [cpp](source/15815.cpp) | 52 | [파일 정리](https://www.acmicpc.net/problem/20291) | [cpp](source/20291.cpp) |
745-
| 53 | [Olympiad Pizza](https://www.acmicpc.net/problem/15235) | [cpp](source/15235.cpp) | | | |
745+
| 53 | [Olympiad Pizza](https://www.acmicpc.net/problem/15235) | [cpp](source/15235.cpp) | 54 | [암기왕](https://www.acmicpc.net/problem/2776) | [cpp](source/2776.cpp) |
746746

747747
</details>
748748

acmicpc.net/source/2776.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// 2776. 암기왕
2+
// 2022.03.13
3+
// 자료구조
4+
#include<iostream>
5+
#include<set>
6+
7+
using namespace std;
8+
9+
int main()
10+
{
11+
ios::sync_with_stdio(0);
12+
cin.tie(0);
13+
cout.tie(0);
14+
int t;
15+
cin >> t;
16+
17+
int n, m, k;
18+
set<int> note;
19+
while (t-- > 0)
20+
{
21+
note.clear();
22+
23+
cin >> n;
24+
for (int i = 0; i < n; i++)
25+
{
26+
cin >> k;
27+
note.insert(k);
28+
}
29+
30+
cin >> m;
31+
for (int i = 0; i < m; i++)
32+
{
33+
cin >> k;
34+
if (note.find(k) == note.end())
35+
{
36+
cout << 0 << "\n";
37+
}
38+
else
39+
{
40+
cout << 1 << "\n";
41+
}
42+
}
43+
}
44+
return 0;
45+
}

0 commit comments

Comments
 (0)