PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000166. Phép thuật tách bóng thành thừa số nguyên tố (Magic For Balls)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Phép thuật tách bóng thành thừa số nguyên tố (Magic For Balls)
Magic For Balls
Source: AtCoder Typical90 075
Version: Phuoc Hung OJ Extended — one dataset per judge run.
Problem Statement
Initially one ball contains . In one operation all balls are struck simultaneously: prime-numbered balls stay unchanged, while a composite-numbered ball is replaced by any two balls with factors and . Minimize the number of operations until all balls are prime-numbered.
Input
One line containing the integer .
Output
Print the minimum number of simultaneous operations.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Example
Input
42
Output
2
Explanation
Since , it has three prime factors counted with multiplicity. Two simultaneous splitting operations suffice.