41. Perfect Number
Core1000 ms256 MBSolved by 0%
A perfect number equals the sum of all its divisors excluding itself.
For example 6 has divisors 1, 2 and 3, and 1 + 2 + 3 = 6.
Read a number and print Yes if it is perfect, or No if it is not.
Constraints - `1 ≤ n ≤ 100000000`
Input
A single line containing one integer n.
Output
Print exactly one word: Yes or No.
Input6
OutputYes
Noteis the smallest perfect number
Input8
OutputNo
Notehas divisors summing to 7, one short
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.