PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000196. Tìm số theo tổng các ước (Short 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
Tìm số theo tổng các ước (Short Task)
Tìm số theo tổng các ước (Short Task)
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Let denote the sum of all positive divisors of . Given , find the smallest positive integer with , or -1 if no such integer exists.
Input
One integer .
Output
Print the minimum , or -1.
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 is itself, so its divisor sum is .
Example 2
Input
12
Output
6
Explanation
The positive divisors of are , summing to . No smaller positive integer has divisor sum .
Example 3
Input
2
Output
-1
Explanation
The sum is for , and at least for ; thus is unattainable.