Notice
Recent Posts
Recent Comments
Link
«   2026/06   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Archives
Today
Total
관리 메뉴

dh-winternagi 님의 블로그

(14425) 문자열 집합 본문

백준 (C++)/Solve

(14425) 문자열 집합

dh-winternagi 2026. 4. 14. 11:12

https://www.acmicpc.net/problem/14425

단계별로 풀어보기

14단계(집합과 맵) 2번째

 

 

 

#include <iostream>
#include <set>
using namespace std;

int main() 
{
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  
  int n, m, ans= 0;
  set<string> s;
  
  cin >> n >> m;
  
  while(n--){
    string t;
    
    cin >> t;
    
    s.insert(t);
  }
  
  while(m--){
    string t;
    
    cin >> t;
    
    ans+= s.count(t);
  }
  
  cout << ans;
  
  return 0;
}

'백준 (C++) > Solve' 카테고리의 다른 글

(1620) 나는야 포켓몬 마스터 이다솜  (0) 2026.04.14
(7785) 회사에 있는 사람  (0) 2026.04.14
(10815) 숫자 카드  (0) 2026.04.14
(10814) 나이순 정렬  (0) 2026.04.14
(1181) 단어 정렬  (0) 2026.04.14