조합할 필요 없이 단순 나누기 결과만 구하면 된다.
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
void input_data(int* N, char* game, set<string>& name)
{
int i;
string str;
cin >> *N >> *game;
for (i = 0; i < *N; i++)
{
cin >> str;
name.insert(str);
}
/*for (string str : name)
{
cout << str << "\n";
}*/
return;
}
void find_answer(char game, set<string> name)
{
int answer;
if (game == 'Y')
{
answer = name.size() / 1;
}
else if(game == 'F')
{
answer = name.size() / 2;
}
else
{
answer = name.size() / 3;
}
cout << answer << "\n";
return;
}
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int N;
char game;
set<string> name;
input_data(&N, &game, name);
find_answer(game, name);
return 0;
}