HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Chapter 3. Repetition structures > problem:


11. Perfect numbers

Volume problems

• 02. How many divisors?
• 04. Train
• 05. Factorial
• 06. X to the power of Y
• 07. Fibonacci Series
• 08. Binary to decimal
• 09. Decimal to binary
• 10. Maximum
• 11. Perfect numbers
• 12. Wonder primes
• 13. Round numbers
• 14. Tower of Happiness
• 2. Molecules
• The power of 2

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 1000/1000/1000/1000 ms. Memory limit 65000/65000/65000/65000 Kb.

Problem description

A perfect number is a natural number and when you add up all of the factors less than that number, you get that number. The first two perfect numbers are 6 and 28. 1+2+3 = 6, and 1+2+4+7+14 = 28.

Make a program that finds out if the given number is perfect or not.

Input

There is a single integer N on the first line (0 < N < 1012).

Output

Write "Yes" if N is perfect and "No" otherwise.

Example

stdin stdout

6

Yes

5 No
Для отправки решений необходимо выполнить вход.

www.contester.ru