728x90
출처
https://www.acmicpc.net/problem/1159
내 풀이
더보기
더보기
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N;
vector<int> player(26, 0);
string result = "";
int main()
{
cin >> N;
for (int i = 0; i < N; i++)
{
string name;
cin >> name;
player[name[0] - 'a']++;
if(player[name[0]-'a'] == 5)
{
result += name[0];
}
}
sort(result.begin(), result.end());
if (result.empty()) cout << "PREDAJA";
else cout << result;
}
느낀점
스무스..
'코딩테스트 공부 2025 Start > 1주차 (구현)' 카테고리의 다른 글
1620) 나는야 포켓몬 마스터 이다솜 (C++) (4) | 2025.04.10 |
---|---|
2559) 수열 (C++) (0) | 2025.04.09 |
9996) 한국이 그리울 땐 서버에 접속하지 (0) | 2025.04.05 |
11655) ROT13 (0) | 2025.04.05 |
10988) 팰린드롬인지 확인하기 (reverse, 투포인터) (0) | 2025.03.30 |