풀이 (성공)
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool compare(int a, int b){
if(a>b){
return true;
}else{
return false;
}
}
vector<int> solution(vector<int> lottos, vector<int> win_nums) {
vector<int> answer;
int low=0;
vector<int> prev;
int high=0;
sort(lottos.begin(), lottos.end(), compare);
sort(win_nums.begin(), win_nums.end(), compare);
int i=0;
while(lottos[i]!=0 && i<6){
for(int j=0; j<6; j++){
if(lottos[i]==win_nums[j]){
low++;
}
}
i++;
}
high = low;
if(i!=6){
for(int j=i; j<6; j++){
high++;
}
}
if(high==6){
answer.push_back(1);
}else if(high==5){
answer.push_back(2);
}else if(high==4){
answer.push_back(3);
}else if(high==3){
answer.push_back(4);
}else if(high==2){
answer.push_back(5);
}else{
answer.push_back(6);
}
if(low==6){
answer.push_back(1);
}else if(low==5){
answer.push_back(2);
}else if(low==4){
answer.push_back(3);
}else if(low==3){
answer.push_back(4);
}else if(low==2){
answer.push_back(5);
}else{
answer.push_back(6);
}
return answer;
}