[프로그래머스] 위장

dev-log·2021년 11월 22일
0

#include
#include
#include<unordered_map>
using namespace std;

int solution(vector<vector> clothes) {
int answer = 1;
unordered_map<string,int> map;

for(int i=0;i<clothes.size();i++){
    map[clothes[i][1]]++;
}
for(auto it=map.begin();it!=map.end();it++)
    answer*=(it->second+1);
return answer-1;

}

for(auto it=map.begin();it!=map.end();it++)
answer*=(it->second+1);

해시에서 반복문 사용하는 법

profile
배운 걸 기록하는 곳입니다.

0개의 댓글