프로그래머스
[프로그래머스-level1]완주하지 못한 선수
반복문을 이용했더니 시간초과가 나서 해시를 이용하여 풀어서 통과했습니다! #include #include #include using namespace std; string solution(vector participant, vector completion) { string answer = ""; map m; for(int i = 0; ifirst; break; } } return answer; }
[프로그래머스-level1]3진법 뒤집기
c++ #include #include #include #include using namespace std; int solution(int n) { int answer = 0; string s = ""; while(n>2){ s += (n%3)+48; n = n/3; } s += n+48; reverse(s.begin(), s.end()); for(int i = 0; i
[프로그래머스-level1]모의고사
c++ #include #include #include using namespace std; vector solution(vector answers) { vector answer; int a[] = {1,2,3,4,5}; int b[] = {2,1,2,3,2,4,2,5}; int c[] = {3,3,1,1,2,2,4,4,5,5}; int score_a = 0; int score_b = 0; int score_c = 0; for(int i = 0; i
[프로그래머스-level1][1차]다트게임
2018 KAKAO BLIND RECRUITMENT 문제 #include #include using namespace std; int solution(string dartResult) { int answer = 0; //점수 총합 int num = 0; vector sum; //1,2,3회 점수기록 for(int i = 0; i='0'&&dartResult[i]