PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000086. Trò chơi người lính và các phép chia (Soldier and Number 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 người lính và các phép chia (Soldier and Number Game)
Soldier and Number Game
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given integers with , consider , where . In each round, choose an integer divisor of the current and replace by . The game ends when . Find the maximum possible number of rounds. Only the maximum count is required, not the sequence of moves.
Input
One line contains integers , in that order.
Output
Print one integer: the maximum possible number of rounds.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
6 3
Output
5
Explanation
Here . Divide successively by to obtain , a total of five rounds. Every round must remove at least one prime factor, so more than five rounds are impossible. Print 5.