#P16075. [ICPC 2023 NAC] Frequent Flier
[ICPC 2023 NAC] Frequent Flier
题目描述
An airline is offering a strange new rewards program to offer free flights to travelers.
The program can be parameterized with two integers and . Within any consecutive months, a traveler must pay for at least of those flights (if there are fewer than flights in that interval, all of those flights must be paid for). Other flights within that interval are free. Note that this condition needs to be true for all -month intervals, including all of the ones that start before your first flight.
You have a schedule of the number of flights you’ll take over the next many months. You want to know the minimum number of flights you’ll need to pay for.
输入格式
The first line of input contains three integers , () and (), where is the number of consecutive months ahead that you have flights planned, and and are the parameters of the airline’s rewards program.
Each of the next lines contains an integer (), which is the number of flights you plan to take during that month.
输出格式
Output a single integer, which is the minimum number of planned flights that you must pay for.
8 3 2
3
1
4
1
5
9
2
6
8