作业帮 > 英语 > 作业

英语翻译A Niven number is a number such that the sum of its digi

来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/05/09 03:36:17
英语翻译
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.
Input
You will be given a number of test cases.Each line of input contains the
base b,followed by a string of digits representing a positive integer in that
base.There are no leading zeroes.The input is terminated by a line consisting
of 0 alone.
Output
For each case,print "yes" on a line if the given number is a Niven number,
and "no" otherwise.
一种机器数是这样的数字之和分.
例如,111是因为,数的数字之和为3,其中
分111.我们还可以指定在另一座B号,和一个数
基B是一个数如果奈文的数字之和将其价值.
给出B(2≤B≤10)和基B一个数,确定它是否是一个机器
数或不.
输入
你会得到一个测试用例的数量.输入的每一行包含了
基B,其次是一个字符串的数字表示在一个正整数
基地.没有前导零.输入由一行终止
0个人.
输出
对于每一种情况下,打印一行“是”如果给定的数是奈文数,
否则,“不”.