문제

https://programmers.co.kr/learn/courses/30/lessons/42840


#include <string>
#include <vector>
#include <cmath>
using namespace std;

vector<int> solution(vector<int> answers) {

    vector<int> answer;
    vector<int> a {1,2,3,4,5};
    vector<int> b {2,1,2,3,2,4,2,5};
    vector<int> c {3,3,1,1,2,2,4,4,5,5};
    int count_a = 0;
    int count_b = 0;
    int count_c = 0;



    for(int i = 0; i < answers.size(); ++i) {
        if(a[i%5] == answers[i]) count_a++;
        if(b[i%8] == answers[i]) count_b++;
        if(c[i%10] == answers[i]) count_c++;
    }

    int max_score = max(max(count_a,count_b),count_c);

    if(max_score == count_a) answer.push_back(1);
    if(max_score == count_b) answer.push_back(2);
    if(max_score == count_c) answer.push_back(3);    

    return answer;
}