题目:
考察内容:
10进制转为任何进制
代码:
"""
题目分析:
输入:
k --物品价值;n 幸运数字;m 进制
输出:
幸运数字的个数
异常;0
eg;
10 2 4
思路;
10 2 -- 1010
"""
k, n, m = map(int, input().split())
def transform1(origin, target):
"""
十进制转为任何进制
:param origin:
:param target:
:return:
"""
remainder_list = list()
while True:
# 余数
remainder = origin % target
remainder_list.append(remainder)
# 商
origin = origin//target
if origin < target:
remainder_list.append(origin)
break
remainder_list.reverse()
return remainder_list
if m <= n:
print(0)
else:
# print(transform1(k, m))
print(transform1(k, m).count(n))