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
前缀和,每个元素都判断一下。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
int n,m,k,t,i;
int a[];
ll ans,pos;
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d",&n,&m,&k);
for(i=;i<n;i++)
scanf("%d",&a[i]);
pos=;
for(i=;i<n;i++)
{
if(a[i]<m)
{
ans=m-a[i];
pos+=ans;
for(int j=i;j<i+k;j++)
{
a[j%n]+=ans;
}
}
}
printf("%lld\n",pos);
}
return ;
}

玲珑学院 1014 Absolute Defeat的更多相关文章

  1. 玲珑学院-ACM比赛1014 - Absolute Defeat

    1014 - Absolute Defeat Time Limit:2s Memory Limit:64MByte Submissions:257Solved:73 DESCRIPTION Eric ...

  2. 玲珑学院oj 1152 概率dp

    1152 - Expected value of the expression Time Limit:2s Memory Limit:128MByte Submissions:128Solved:63 ...

  3. 玲珑学院1072 【DFS】

    蛤蛤,略蠢. priority_queue 自定义优先级 和排序是反的 struct node { int x,y; friend bool operator< (node a,node b) ...

  4. 玲珑学院OJ 1023 - Magic boy Bi Luo with his excited math problem 树状数组暴力

    分析:a^b+2(a&b)=a+b  so->a^(-b)+2(a&(-b))=a-b 然后树状数组分类讨论即可 链接:http://www.ifrog.cc/acm/probl ...

  5. 玲珑学院OJ 1028 - Bob and Alice are playing numbers 字典树,dp

    http://www.ifrog.cc/acm/problem/1028 题解处:http://www.ifrog.cc/acm/solution/4 #include <cstdio> ...

  6. 玲珑学院 1010 - Alarm

    1010 - Alarm Time Limit:1s Memory Limit:128MByte DESCRIPTION Given a number sequence [3,7,22,45,116, ...

  7. 玲珑学院 1050 - array

    1050 - array Time Limit:3s Memory Limit:64MByte Submissions:494Solved:155 DESCRIPTION 2 array is an ...

  8. 玲珑学院 1052 - See car

    1052 - See car Time Limit:2s Memory Limit:64MByte Submissions:594Solved:227 DESCRIPTION You are the ...

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

随机推荐

  1. Bayes++ Library入门学习之熟悉class-Bayesian_filter_base(1)

    在对Bayes++库的名称空间有了一个大概的了解之后,我们开始学习该名称空间下的第一个子类Bayesian_filter::Bayes_filter_base. 该类与其子类的继承关系图如下图所示. ...

  2. codeforces 495D Sonya and Matrix

    Since Sonya has just learned the basics of matrices, she decided to play with them a little bit. Son ...

  3. python 中的property

    """ property() 的第一个参数是 getter 方法,第二个参数是 setter 方法 xx = property(a,b) @property #用于指示g ...

  4. [Bug]Python3.x SyntaxError: 'ascii' codec can't decode byte 0xe4 in position

    安装arch后就没再用python了 昨天管服务器的大佬在跑贝叶斯分类器的时候发现正确率有问题 我赶紧去做优化,然后就有这样的报错 Python 3.6.4 (default, Jan 5 2018, ...

  5. MySQL日志设置及查看方法

    MySQL有以下几种日志: 错误日志: -log-err 查询日志: -log 慢查询日志: -log-slow-queries 更新日志: -log-update 二进制日志: -log-bin 默 ...

  6. POJ——T 1988 Cube Stacking

    http://poj.org/problem?id=1988 Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 25865   ...

  7. 一 SSH 无密码登陆 & Linux防火墙 & SELinux关闭

    如果系统环境崩溃.   调用/usr/bin/vim /etc/profile   SHH无密码登陆 所有要做得节点上运行   修改 host name vi /etc/sysconfig/netwo ...

  8. ArcGIS api for javascript——查询没有地图的数据

    描述 本例展示了用户能够从没有显示服务的地图服务查询数据.大部分地图服务包含属性信息的数据集,数据集能够被查询并显示在一个简单的列或表格里. 本例按提供的州名称查询USA人口普查数据,然后显示关于州的 ...

  9. ArcGIS api for javascript——合并两个ArcGIS Online服务

    描述 这个示例创建一个地图并ArcGIS Online增加连个图层到地图.ArcGIS Online是由ESRI体提供的一组切片地图服务,可以用来通过高质量的地图和数据增强应用.这个示例增加影像和运输 ...

  10. .ds_store是什么文件

    .ds_store是什么文件 .DS_Store是Mac OS保存文件夹的自定义属性的隐藏文件,如文件的图标位置或背景色,相当于Windows的desktop.ini. 1,禁止.DS_store生成 ...