https://school.programmers.co.kr/learn/courses/30/lessons/176963?language=cpp
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
#include <bits/stdc++.h>
std::vector<int> solution(std::vector<std::string> name, std::vector<int> yearning, std::vector<std::vector<std::string>> photo) {
std::vector<int> answer;
std::unordered_map<std::string, int> nameYearningMap;
for (int i = 0; i < name.size(); ++i){
nameYearningMap[name[i]] = yearning[i];
}
for (int i = 0; i < photo.size(); ++i){
int res = 0;
for (int j = 0; j < photo[i].size(); ++j){
if (nameYearningMap.find(photo[i][j]) != nameYearningMap.end()){
res += nameYearningMap[photo[i][j]];
}
}
answer.push_back(res);
}
return answer;
}
'프로그래머스 문제풀이 > LEVEL 1' 카테고리의 다른 글
[C++] 프로그래머스 문제풀이 LEVEL 1 폰켓몬 (0) | 2023.07.02 |
---|---|
[C++] 프로그래머스 문제풀이 LEVEL 1 2016년 (0) | 2023.07.02 |
[C++] 프로그래머스 문제풀이 LEVEL 1 콜라 문제 (0) | 2023.07.02 |
[C++] 프로그래머스 문제풀이 LEVEL 1 가장 가까운 같은 글자 (0) | 2023.07.02 |
[C++] 프로그래머스 문제풀이 LEVEL 1 푸드 파이트 대회 (0) | 2023.07.02 |