该题目来源于YAHOO 2017年面试题
Deion:(Playing with digits)
Some numbers have funny properties.
For example:
Given a positive integer n written as abcd... (a, b, c, d... being digits) and a positive integer p we want to find a positive integer k, if it exists, such as the sum of the digits of n taken to the successive powers of p is equal to k * n. In other words:?(给定一个正整数n手机软件测试面试题,写为abcd ...(a,b,c,d ...为数字)和正整数p,手机软件测试面试题我们想要找到一个正整数k,如果存在,如数字之和 对于p的连续幂,n等于k * n。 换一种说法:)
If it is the case we will return k, if not return -1.(如果是这种情况,手机软件测试面试题我们将返回k,如果不返回-1。)
Note: n, p will always be given as strictly positive integers.(注意:n,p将始终作为严格正整数给出)
答案:
欢迎大家踊跃回答,把您认为最简洁、高效、有趣的答案,发送到猿助猿后台手机软件测试面试题!与小编互动即有机会获得价值不菲的精美礼品哦~赶紧“躁”起来吧!
觉得本文有帮助手机软件测试面试题?请分享给更多人
关注「猿助猿」成就顶级开发
技术交流QQ群:517877452
暂无个人介绍