-
[프로그래머스 12899번] 124 나라의 숫자Coding Test/프로그래머스 2020. 11. 17. 19:02
# 문제
내 풀이
def solution(n): answer = '' num = ['1', '2', '4'] # 124 나라의 수를 3진법의 0, 1, 2에 대응시킴 while n: n -= 1 # 3진법에 124나라 숫자를 대응시키기위해 10진법 숫자에서 1을 뺌 answer = num[n % 3] + answer n //= 3 return answer
'Coding Test > 프로그래머스' 카테고리의 다른 글
[프로그래머스 42578번] 위장 (0) 2020.12.19 [프로그래머스 42577번] 전화번호 목록 (0) 2020.12.19 [프로그래머스 49993번] 스킬트리 (0) 2020.11.17 [프로그래머스 42586번] 기능개발 (0) 2020.11.17 [프로그래머스 42576번] 완주하지 못한 선수 (0) 2020.11.17