2018-2019-2 20,175,310 individual project reports 1-- narcissistic number

2018-2019-2 20,175,310 individual project reports 1-- narcissistic number

definition:

Refers to a number of daffodils nbits (n≥3 ), on each of its digital bit npower equals itself(例如:1^3 + 5^3+ 3^3 = 153)

demand analysis:

According to the definition of the number of daffodils, it was designed and implemented in the Java language.

Design and Implementation:

Since the number of daffodils is at least three-digit numbers, so I realized that include 100-999all numbers between daffodils.
Pseudo-code as follows:

1、将要判断的数除以100,求得该数的百位b。
2、将该数减去百位b*100,然后再除以10,求得十位s。
3、用该数减去百位b*100再减去十位s*10,得到个位数g。
4、判断百位b的三次方加百位b的三次方加个位数g的三次方是否与原来的数相等,若相等则输出,否则计算下一个数。
5、输出100-999之间水仙花数的个数

Difficulties Summary:

This program is very simple, there is only one main class, what did not call, and last year, when learning C also written several daffodils, which can be realized without any problems.

Screenshot operating results:

Cloud link code

PSP time

step Consuming (min) percentage
demand analysis 10 11%
design 15 16%
Code 25 27%
test 10 11%
analysis Summary 30 32%

Guess you like

Origin www.cnblogs.com/xicyannn/p/10883695.html
Recommended