Problems > Perfect Number

Perfect Number

Difficulty: 1100 3000 ms 128 MB

math

A number is perfect if it equals the sum of its proper divisors (divisors excluding itself). Is N perfect?

Input: one integer N.

Output: YES or NO.

Constraints:

  • 1 ≤ N ≤ 1010

Sample Tests

Input 1
28
Output 1
YES
Input 2
12
Output 2
NO

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.