本文共 1423 字,大约阅读时间需要 4 分钟。
Time Limit:2s Memory Limit:64MByte
Submissions:257Solved:73
Eric has an array of integers
a1,a2,...,ana1,a2,...,an. Every time, he can choose a contiguous subsequence of length
kk and increase every integer in the contiguous subsequence by
11.He wants the minimum value of the array is at least
mm. Help him find the minimum number of operations needed.
There are multiple test cases. The first line of input contains an integer
TT, indicating the number of test cases. For each test case:The first line contains three integers
nn,
mm and
kk (1≤n≤105,1≤k≤n,1≤m≤104)(1≤n≤105,1≤k≤n,1≤m≤104).The second line contains
nn integers
a1,a2,...,ana1,a2,...,an (1≤ai≤104)(1≤ai≤104).
For each test case, output an integer denoting the minimum number of operations needed.
32 2 21 15 1 41 2 3 4 54 10 31 2 3 4
1015
源代码:
#include #include #include #include #include #include #include #include #include
转载地址:http://txjyz.baihongyu.com/