728x90
반응형
11645 I've Been Everywhere, Man
문제풀이
#include <iostream>
#include <map>
using namespace std;
map<string,bool> m;
int main(void)
{
int t;
cin >> t;
while(t--)
{
int cities;
cin >> cities;
for(int i=0;i<cities;i++)
{
string str;
cin >> str;
if(!m[str])
m.insert({str,true});
}
cout << m.size() << "\n";
m.clear();
}
}
map 에 넣어서 사이즈를 체크했다.
728x90
반응형
'자라는 개발자 > 문제풀이' 카테고리의 다른 글
백준 c++ 11728 배열 합치기 (0) | 2022.08.15 |
---|---|
백준 c++ 9933 민균이의 비밀번호 (0) | 2022.08.08 |
백준 c++ 15577 Prosjek (0) | 2022.07.20 |
백준 c++ 21194 Meditation (0) | 2022.07.11 |
백준 c++ 7795 먹을 것인가 먹힐 것인가 (0) | 2022.07.10 |