반응형
<코드>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
using namespace std;
int N, M, ans;
string s;
map<string, bool> m;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> N >> M;
for (int i = 0; i < N; i++)
{
cin >> s;
m[s] = true;
}
for (int i = 0; i < M; i++)
{
cin >> s;
if (m[s]) ans++;
}
cout << ans << '\n';
}
14425번: 문자열 집합
첫째 줄에 문자열의 개수 N과 M (1 ≤ N ≤ 10,000, 1 ≤ M ≤ 10,000)이 주어진다. 다음 N개의 줄에는 집합 S에 포함되어 있는 문자열들이 주어진다. 다음 M개의 줄에는 검사해야 하는 문자열들이 주어
www.acmicpc.net
반응형
'🧩PS > 🥈Nomal' 카테고리의 다른 글
[C/C++] 백준 1600번 - 말이 되고픈 원숭이 (0) | 2021.03.26 |
---|---|
[C/C++] 백준 1915번 - 가장 큰 정사각형 (DP) (0) | 2021.03.26 |
[C/C++] 백준 17404번 - RGB거리 2 (0) | 2021.03.23 |
[C/C++] 백준 14501번 - 퇴사 (0) | 2021.03.22 |
[C/C++] 백준 11052번 - 카드 구매하기 (0) | 2021.03.22 |