웅재의 코딩세상

[프로그래머스] PCCE 기출문제 6번 본문

코딩테스트/프로그래머스 - LV 0

[프로그래머스] PCCE 기출문제 6번

웅드 2024. 2. 9. 16:27

 

  • 풀이
#include <string>
#include <vector>

using namespace std;

vector<string> solution(vector<int> numbers, vector<int> our_score, vector<int> score_list) {
    int num_student = numbers.size();
    vector<string> answer(num_student);
    
    for (int i = 0; i < num_student; i++) {
        if (our_score[i] == score_list[numbers[i]-1]) {
            answer[i] = "Same";
        }
        else {
            answer[i] = "Different";
        }
    }
    
    return answer;
}
반응형