AmazonOA #171
Find Minimum Days
估计中等可在线判题
Each day, choose exactly k consecutive chapters and read at most p pages of each chosen chapter (a chapter with fewer than p pages left is simply finished). Chapters may be chosen repeatedly, and a finished chapter can still be chosen. Find the minimum number of days needed to finish every chapter.
输入格式
The first line contains n k p; the second line contains the page count of each chapter. 1≤n≤100000, 1≤k≤n, 1≤p,pages≤10^9.
输出格式
Output a single integer, the answer.
样例 1
输入:
3 2 2
3 1 4
输出:
4
样例 2
输入:
2 1 2
3 4
输出:
4
样例 3
输入:
3 3 10
1 1 1
输出:
1
样例说明
Example 1: choose the first two chapters twice and the last two chapters twice, 4 days in total. Example 2: each of the two chapters needs 2 days and they cannot be read on the same day, so the answer is 4. Example 3: one selection covers everything and p is large enough, so the answer is 1.