PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000129. Thuế thu nhập (Taxes)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Thuế thu nhập (Taxes)
Taxes
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A person has total income burles. The tax on an amount equals the largest positive proper divisor of . For instance, the tax is for , for , and for .
The person may split into any positive number of parts , with each . Each part is taxed separately. Find the minimum possible sum of taxes.
Input
One line containing the integer .
Output
Print one integer: the minimum total tax.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
27
Output
3
Explanation
For , split it as . All three parts are prime, so each tax is and the total is . A total of is impossible because is composite, and a total of is impossible because is composite. Thus print 3.