文件名称:TestAlgorithm
介绍说明--下载内容均来自于网络,请自行研究使用
求花朵数的JAVA代码实现
一个N位的十进制正整数,如果它的每个位上的数字的N次方的和等于这个数本身,则称其为花朵数。
例如:
当N=3时,153就满足条件,因为 1^3 + 5^3 + 3^3 = 153,这样的数字也被称为水仙花数(其中,“^”表示乘方,5^3表示5的3次方,也就是立方)。
当N=4时,1634满足条件,因为 1^4 + 6^4 + 3^4 + 4^4 = 1634。
当N=5时,92727满足条件。
实际上,对N的每个取值,可能有多个数字满足条件。
程序的任务是:求N=21时,所有满足条件的花朵数。注意:这个整数有21位,它的各个位数字的21次方之和正好等于这个数本身。
如果满足条件的数字不只有一个,请从小到大输出所有符合条件的数字,每个数字占一行。因为这个数字很大,请注意解法时间上的可行性。要求程序在3分钟内运行完毕
-An N-bit decimal integer, if each of its N-bit numbers on the power and is equal to the number itself, called it the number of flowers.
For example:
When N = 3, the 153 to meet the conditions, because 1 ^ 3+ 5 ^ 3+ 3 ^ 3 = 153, that figure is also known as Narcissus number (where "^" means power, 5 ^ 3 said 5 3 power, which is cubic).
When N = 4, the 1634 to meet the conditions, because 1 ^ 6 ^ 4+ 4+ 4+ 4 ^ 3 ^ 4 = 1634.
When N = 5, the 92,727 to meet the conditions.
In fact, for each N value, there may be multiple numbers to meet the conditions.
Program s mission is: find N = 21, all meet the conditions of flower number. Note: This integer has 21 bits, each digit of its 21 th power, and exactly equal to the number itself.
If the figures do not meet the conditions of only one, make small to large output of all eligible numbers, each number per line. Because of this high number, please note that the feasibility of solution time. Claims process has finished running in 3 m
一个N位的十进制正整数,如果它的每个位上的数字的N次方的和等于这个数本身,则称其为花朵数。
例如:
当N=3时,153就满足条件,因为 1^3 + 5^3 + 3^3 = 153,这样的数字也被称为水仙花数(其中,“^”表示乘方,5^3表示5的3次方,也就是立方)。
当N=4时,1634满足条件,因为 1^4 + 6^4 + 3^4 + 4^4 = 1634。
当N=5时,92727满足条件。
实际上,对N的每个取值,可能有多个数字满足条件。
程序的任务是:求N=21时,所有满足条件的花朵数。注意:这个整数有21位,它的各个位数字的21次方之和正好等于这个数本身。
如果满足条件的数字不只有一个,请从小到大输出所有符合条件的数字,每个数字占一行。因为这个数字很大,请注意解法时间上的可行性。要求程序在3分钟内运行完毕
-An N-bit decimal integer, if each of its N-bit numbers on the power and is equal to the number itself, called it the number of flowers.
For example:
When N = 3, the 153 to meet the conditions, because 1 ^ 3+ 5 ^ 3+ 3 ^ 3 = 153, that figure is also known as Narcissus number (where "^" means power, 5 ^ 3 said 5 3 power, which is cubic).
When N = 4, the 1634 to meet the conditions, because 1 ^ 6 ^ 4+ 4+ 4+ 4 ^ 3 ^ 4 = 1634.
When N = 5, the 92,727 to meet the conditions.
In fact, for each N value, there may be multiple numbers to meet the conditions.
Program s mission is: find N = 21, all meet the conditions of flower number. Note: This integer has 21 bits, each digit of its 21 th power, and exactly equal to the number itself.
If the figures do not meet the conditions of only one, make small to large output of all eligible numbers, each number per line. Because of this high number, please note that the feasibility of solution time. Claims process has finished running in 3 m
(系统自动生成,下载前可以参看下载内容)
下载文件列表
TestAlgorithm.java