PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000031. Trò chơi chia số (Div Game)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Trò chơi chia số (Div Game)
Div Game
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
You are given a positive integer . You may repeat the following operation:
- Choose a positive integer , where is prime and .
- The value must divide the current value of .
- The value must not have been chosen in an earlier operation.
- Replace with .
Find the maximum number of operations possible. Values must be distinct, but different powers of the same prime are allowed.
Input
One line containing the positive integer .
Output
Output the maximum possible number of operations as one integer.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
24
Output
3
Explanation
Start with . Choose to obtain , then to obtain , and finally to obtain . The three chosen prime powers are distinct, giving operations.
Input
64
Output
3
Explanation
Starting at , choose , , . Their exponents sum to , exhausting in moves.
Input
1
Output
0
Explanation
The integer has no divisor of the form with , so no move is possible.