프로그래머스 176963 추억 점수

1 개요[ | ]

프로그래머스 176963 추억 점수

2 C++[ | ]

#include <string>
#include <vector>
#include <map>

using namespace std;

vector<int> solution(vector<string> name, vector<int> yearning, vector<vector<string>> photo) {
    map<string, int> m;
    for(int i=0; i<name.size(); i++) {
        m[name[i]] = yearning[i];
    }
    vector<int> answer;
    for(vector<string> names: photo) {
        int sum = 0;
        for(string el: names) {
            sum += m[el];
        }
        answer.emplace_back(sum);
    }
    return answer;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}