자라는 개발자/문제풀이
백준 c++ 11645 I've Been Everywhere, Man
자란다
2022. 7. 23. 07:23
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
반응형