https://school.programmers.co.kr/learn/courses/30/lessons/42578
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
#include <string>
#include <vector>
#include <iostream>
#include <unordered_map>
using namespace std;
int solution(vector<vector<string>> clothes) {
int answer = 1;
unordered_map<string, int> type;
for(int i = 0; i < clothes.size(); i++){
type[clothes[i][1]]++;
}
for(auto a : type){
answer *= a.second+1;
}
return --answer;
}
728x90
반응형
'공부 > C++' 카테고리의 다른 글
[c++] 프로그래머스 소수 찾기 (0) | 2025.05.02 |
---|---|
[C++] 프로그래머스 코드처리하기 (0) | 2025.04.21 |
[C++] 프로그래머스 전화번호 목록 (0) | 2025.04.04 |
[C++] 프로그래머스 폰켓몬 (1) | 2025.04.04 |
[C++] 프로그래머스 완주하지 못한 선수 (0) | 2025.04.04 |