40. Armstrong Number
Core1000 ms256 MBSolved by 0%
An Armstrong number equals the sum of its own digits, each raised to the power of how many digits it has.
For example 153 has three digits, and 1³ + 5³ + 3³ = 153.
Read a number and print Yes if it is an Armstrong number, or No if it is not.
Constraints - `1 ≤ n ≤ 1000000000`
Input
A single line containing one integer n.
Output
Print exactly one word: Yes or No.
Input153
OutputYes
Noteis the worked example from the statement
Input154
OutputNo
Noteis one more than an Armstrong number
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.