CodingTest Practice/Programmers 33

프로그래머스 : 모의고사 (C++, Lv.1)

#include #include using namespace std; int supoja_1[] = {1, 2, 3, 4, 5}; int supoja_2[] = {2, 1, 2, 3, 2, 4, 2, 5}; int supoja_3[] = {3, 3, 1, 1, 2, 2, 4, 4, 5, 5}; //1번 수포자 패턴 : 1, 2, 3, 4, 5 //2번 수포자 패턴 : 2, 1, 2, 3, 2, 4, 2, 5 //3번 수포자 패턴 : 3, 3, 1, 1, 2, 2, 4, 4, 5, 5 vector solution(vector answers) { vector answer; //인원별 정답 갯수 변수 int ans_1 = 0, ans_2 = 0, ans_3 = 0; //현재 문제번호 변수 int cur_num..

프로그래머스 : 로또의 최고 순위와 최저 순위 (C++, Lv.1)

#include #include #include using namespace std; vector solution(vector lottos, vector win_nums) { vector answer; int x= 0, same = 0; sort(lottos.begin(), lottos.end()); sort(win_nums.begin(),win_nums.end()); int l_point = 0, w_point = 0; while(l_point < 6 && w_point < 6){ //0이 있는 경우 if(lottos[l_point] == 0) { x++; l_point++; continue; } //같은 경우 if(lottos[l_point] == win_nums[w_point]) { same++; ..

프로그래머스 : 기능개발 (C++)

아래 블로그를 참고해 작성한 코드임을 명시합니다. https://ongveloper.tistory.com/76 프로그래머스 기능개발 c++ (스택/큐) 문제 출처 : https://programmers.co.kr/learn/courses/30/lessons/42586 코딩테스트 연습 - 기능개발 프로그래머스 팀에서는 기능 개선 작업을 수행 중입니다. 각 기능은 진도가 100%일 때 서비스에 반영할 수 있.. ongveloper.tistory.com 코드1 벡터progresses에 벡터speeds값을 매번 더해 맨앞원소가 100 이상인지 확인하고, 이상이면 벡터의 값을 큐q에 넣어 q.front()가 100이 넘는지 확인 #include #include #include using namespace std;..