[求助]大数除法问题
对任意进制下的大数做除法.
当然有了,说具体点吧:
对输入一个某进制下的整数,判断是否整除该数的各位和.
例如:
input
10 111
解释: 该测试是十进制数111可以整除3(1+1+1).
5 1234
解释:5进制数1234不可以整除20(5进制数)(1+2+3+4)
判断是否可以整除问题.
对输入的一个某进制下的整数,是否可以整除该数各位数之和.
这是背景:
A Niven number is a number such that the sum of its digits divides itself. For example, 111 is a Niven number because the sum of its digits is 3, which divides 111. We can also specify a number in another base b, and a number in base b is a Niven number if the sum of its digits divides its value.
Given b (2 <= b <= 10) and a number in base b, determine whether it is a Niven number or not.
我就演变了一下.高手求教.