#CCBCHMOT0000050. Số hoàn hảo có tối ưu nhẹ (Perfect Number with Divisor Pairs)
Số hoàn hảo có tối ưu nhẹ (Perfect Number with Divisor Pairs)
Perfect Number with Divisor Pairs
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
A positive integer n is perfect if the sum of all its positive proper divisors equals n. Determine whether n is perfect.
Input
One positive integer n.
Output
Print YES if perfect, otherwise NO.
Subtasks
- Subtask 1 (20%): 1≤n≤100.
- Subtask 2 (30%): 1≤n≤100000.
- Subtask 3 (50%): 1≤n≤100000000.
Examples
Example 1
Input
6
Output
YES
Explanation
Proper divisors 1,2,3 sum to six.
Example 2
Input
1
Output
NO
Explanation
One has no proper positive divisors.