“玲珑杯”ACM比赛 Round #1

Posted Roni

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了“玲珑杯”ACM比赛 Round #1相关的知识,希望对你有一定的参考价值。

Start Time:2016-08-20 13:00:00 End Time:2016-08-20 18:00:00 Refresh Time:2017-11-12 19:51:52 Public

A -- Absolute Defeat

Time Limit:2s Memory Limit:64MByte

Submissions:394Solved:119

DESCRIPTION

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.

INPUT
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 (1n105,1kn,1m104)(1≤n≤105,1≤k≤n,1≤m≤104). The second line contains nn integers a1,a2,...,ana1,a2,...,an (1ai104)(1≤ai≤104).
 
OUTPUT
For each test case, output an integer denoting the minimum number of operations needed.
 
SAMPLE INPUT
3
2 2 2
1 1
5 1 4
1 2 3 4 5
4 10 3
1 2 3 4
SAMPLE OUTPUT
1
0
15
SOLUTION
 
【题意】:给你一个长度为n的序列,每次你只能选择连续的k个数字加1,问你要进行多少次操作才能使所有的a[i]都大于m。 
【分析】:
【代码】:

以上是关于“玲珑杯”ACM比赛 Round #1的主要内容,如果未能解决你的问题,请参考以下文章

“玲珑杯”ACM比赛 Round #1

“玲珑杯”ACM比赛 Round #19 B -- Buildings (RMQ + 二分)

“玲珑杯”ACM比赛 Round #23

玲珑杯”ACM比赛 Round #19 B 维护单调栈

“玲珑杯”ACM比赛 Round #18 A 暴力水 C dp

“玲珑杯”ACM比赛 Round #19 B -- Buildings