키패드 누르기1 [프로그래머스][C++] 키패드 누르기 #include #include using namespace std; string solution(vector numbers, string hand) { string answer = ""; // 각 손의 초기 위치 int curLeft = 10; // * int curRight = 12; // # for(int i = 0; i < numbers.size(); i++) { // 0은 위치상 11로 간주 int curNum = numbers[i] == 0 ? 11 : numbers[i]; if(curNum % 3 == 1) { // 1, 4, 7 answer += "L"; curLeft = curNum; } else if(curNum % 3 == 0) { // 3, 6, 9 answer += "R"; cur.. 2023. 10. 16. 이전 1 다음