1. 235数字组合,和leetcode017相似
n = int(input()) p = '235' tmp = [''] res = [] for i in range(6): tmp = [i+j for i in p for j in tmp] res += tmp print(res[n-1])
2. 十进制转换成五进制
n = input() s = n[::-1] num = int(s) res = [] while num//5: res.append(num % 5) num = num//5 res.append(num%5) res = list(map(str, res)) print(''.join(res[::-1]))
全部评论
(0) 回帖