A: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 (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).
OUTPUT
For each test case, output an integer denoting the minimum number of operations needed.
SAMPLE INPUT

SAMPLE OUTPUT

题目链接:http://ifrog.cc/acm/problem/1014?contest=1001&no=0

*************************************

错误代码:(貌似错的还挺离谱,没办法,太弱了)

 #include<stdio.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<algorithm>
#include<time.h>
#include<stack>
using namespace std;
#define N 120000
#define INF 0x3f3f3f3f int a[N]; int main()
{
int T,n,m,k,i; scanf("%d", &T); while(T--)
{
scanf("%d %d %d", &n,&m,&k); for(i=; i<n; i++)
scanf("%d", &a[i]); sort(a,a+n); int i=,sum=;
while(i<n)
{
if(m-a[i]>)
sum+=m-a[i];
i+=k;
}
printf("%d\n",sum);
} return ;
}

 比赛全部的题从链接里面找,有兴趣的可以自己做做看。下面是全部题解:

“玲珑杯”ACM比赛 Round #1 题解的更多相关文章

  1. “玲珑杯”ACM比赛 Round #12题解&源码

    我能说我比较傻么!就只能做一道签到题,没办法,我就先写下A题的题解&源码吧,日后补上剩余题的题解&源码吧!                                     A ...

  2. “玲珑杯”ACM比赛 Round #19题解&源码【A,规律,B,二分,C,牛顿迭代法,D,平衡树,E,概率dp】

    A -- simple math problem Time Limit:2s Memory Limit:128MByte Submissions:1599Solved:270 SAMPLE INPUT ...

  3. “玲珑杯”ACM比赛 Round #13 题解&源码

    A 题目链接:http://www.ifrog.cc/acm/problem/1111 分析:容易发现本题就是排序不等式, 将A数组与B数组分别排序之后, 答案即N∑i=1Ai×Bi 此题有坑,反正据 ...

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

    “玲珑杯”ACM比赛 Round #19 Start Time:2017-07-29 14:00:00 End Time:2017-07-29 16:30:00 Refresh Time:2017-0 ...

  5. “玲珑杯”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 ...

  6. “玲珑杯”ACM比赛 Round #18

    “玲珑杯”ACM比赛 Round #18 Start Time:2017-07-15 12:00:00 End Time:2017-07-15 15:46:00 A -- 计算几何你瞎暴力 Time ...

  7. “玲珑杯”ACM比赛 Round #18--最后你还是AK了(搜索+思维)

    题目链接   DESCRIPTION INPUT OUTPUT SAMPLE INPUT 1 4 2 1 2 5 2 3 5 3 4 5 5 5 SAMPLE OUTPUT 35 HINT 对于样例, ...

  8. 玲珑杯”ACM比赛 Round #4 1054 - String cut 暴力。学到了扫描的另一种思想

    http://www.ifrog.cc/acm/problem/1054 问删除一个字符后的最小循环节是多少. 比赛的时候想不出,不知道怎么暴力. 赛后看了别人代码才晓得.唉,还以为自己字符串还不错, ...

  9. lonlifeOJ1152 “玲珑杯”ACM比赛 Round #19 概率DP

    E -- Expected value of the expression DESCRIPTION You are given an expression: A0O1A1O2A2⋯OnAnA0O1A1 ...

随机推荐

  1. logrotate日志轮转配置文档

    转自:http://blog.163.com/bull_linux/blog/static/2138811422013101334544349/ 使用:    logrotate CONF_FILE+ ...

  2. grub引导centos

    下面来主要讲一下在grub下来引导centos: 其步骤如下; a   进入grub的命令模式. b  先熟悉一下grub  的一些命令 grub>help c  熟悉一下cat命令 d  ro ...

  3. IAR和Keil文件包含路径设置

    在模块化编程时,为一个模块单独设置头文件是必不可少的. 在两款主流编译器中,在引用模块函数时候,包含头文件路径是必须的,那么设置文件路径的准确性就显得尤为重要. 否则,编译器会报错,无法打开某某头文件 ...

  4. 从0开始学习blockchain

    http://www.8btc.com/build-your-own-blockchain

  5. POJ1113 Wall 凸包

    题目大意:建立围墙将城堡围起来,要求围墙至少距离城堡L,拐角处用圆弧取代,求围墙的长度. 题目思路:围墙长度=凸包周长+(2*PI*L),另外不知道为什么C++poj会RE,G++就没问题. #inc ...

  6. Android makefile 组织结构

    下面是main.mk文件包含关系,本文档主要说明的就是这些文件里到底做了什么.(这个文件被根目录下的makefile文件包含) 一.     main.mk BUILD_SYSTEM=build/co ...

  7. 还原openstack配置文件的方法

    cp -a /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bakcp -a /etc/neutron/plugins/ml2/ml2_conf ...

  8. 字符串匹配之boyer-Moore算法

    Boyer-Moore算法不仅效率高,而且构思巧妙,容易理解.1977年,德克萨斯大学的Robert S. Boyer教授和J Strother Moore教授发明了这种算法. 下面,我根据Moore ...

  9. APP测试中的头疼脑热:测试人员如何驱动开发做好自测

    如今,随着移动互联网的浪潮越翻越涌,移动APP测试工作的现状已经成了那本"家家难念"的经.不管公司大小,不管测试哪种类型的APP,让广泛测试者苦不堪言的就属重复性最多,测试工作量最 ...

  10. DLL and LIB

    在StackOverflow中看到一个提问“what's the difference between DLL's and LIB's?” 有如下回复值得参考: 回复一: