PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000207. Nghịch đảo tổng các ước (Alternate Task)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Nghịch đảo tổng các ước (Alternate Task)
Nghịch đảo tổng các ước (Alternate Task)
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Let be the sum of all positive divisors of , including and . Given , find the largest positive integer such that . Print if none exists.
Input
One line with .
Output
Print the largest or .
Subtasks
-
Subtask 1 (20 points): .
-
Subtask 2 (30 points): .
-
Subtask 3 (50 points): .
Examples
Example 1
Input
1
Output
1
Explanation
The only positive divisor of 1 is 1.
Example 2
Input
102
Output
101
Explanation
101 is prime and its divisor sum is 102. No larger integer can have that divisor sum.
Example 3
Input
1000
Output
-1
Explanation
No positive integer has divisor sum equal to 1000.