PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000172. Giai thừa và bội số (Factorial and Multiple)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Giai thừa và bội số (Factorial and Multiple)
Factorial and Multiple
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer , define the factorial of a positive integer as
An integer is valid when divides , i.e. for some integer . Find the smallest positive integer for which this holds. A solution is guaranteed to exist.
Print , not . The factorial itself may be too large to represent directly.
Input
One line containing the integer .
Output
Print the smallest positive integer satisfying .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
30
Output
5
Explanation
is not divisible by , whereas . Thus the minimum is .
Example 2
Input
280
Output
7
Explanation
is not divisible by , but , so the answer is .