-
47. [3차] n진수 게임코딩 테스트/Level 2 2020. 8. 30. 14:14반응형
[3차] n진수 게임
2018 KAKAO BLIND RECRUITMENT
1486명 완료https://programmers.co.kr/learn/courses/30/lessons/17687
def solution(n, t, m, p): temp = [] index, num = 0, 0 while len(temp) < t: for each in jin(num, n): if index % m + 1 == p: temp.append(each) index += 1 num += 1 return ''.join(temp[:t]) def jin(num, n): if num == 0: return '0' temp = [] while num > 0: temp.append(hex(num % n)[2:].upper()) num = num // n temp.reverse() return ''.join(temp)
반응형