PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000009. Chọn bội số có tổng lớn nhất (Maximum Multiple Sum)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Chọn bội số có tổng lớn nhất (Maximum Multiple Sum)
Maximum Multiple Sum
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given , choose an integer with that maximizes the sum of all positive multiples of not exceeding . The optimal choice is guaranteed unique.
Input
One line containing integer .
Output
Print the optimal value of .
Subtasks
- Subtask 1 (20 points):
- Subtask 2 (30 points):
- Subtask 3 (50 points):
Examples
Input
15
Output
2
Explanation
Choosing gives , the largest possible sum.