프로그래머스 체육복 Level 1 [c++]


프로그래머스 체육복 Level 1 [c++]

#include #include #include #include #include using namespace std; int solution(int n, vector lost, vector reserve) { int answer = 0; bool visited[31] = { false, }; int cnt = 0; //여벌의 체육복으로 해결된 학생수 int len = lost.size(); //도난당한학생수 sort(lost.begin(), lost.end()); //오름차순으로 정렬, 정렬을해야 근처 번호를 우선적으로 확인가능 sort(reserve.begin(), reserve.end()); for (int i = 0; i < lost.size(); i++) //여벌체육복을 가져왔지만 도난당한 경우 ..


원문링크 : 프로그래머스 체육복 Level 1 [c++]