PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000295. Frodo và những chiếc gối (Frodo and pillows)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Frodo và những chiếc gối (Frodo and pillows)
Frodo and pillows
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are beds in a row and pillows. Every bed receives at least one pillow, all pillows must be distributed, and adjacent beds may differ by at most one pillow. Frodo occupies bed (1-based). Maximize his pillow count.
Input
One line contains three integers .
Output
Print one integer: the maximum achievable value.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; .
Examples
Input 1
4 6 2
Output 1
2
Explanation
Allocation (2,2,1,1) works. Giving Frodo three requires at least eight pillows.
Input 2
3 10 3
Output 2
4
Explanation
Allocation (3,3,4) works. Five at bed 3 requires at least twelve.