博客
关于我
玲珑学院-ACM比赛1014 - Absolute Defeat
阅读量:436 次
发布时间:2019-03-06

本文共 1423 字,大约阅读时间需要 4 分钟。

1014 - Absolute Defeat

Time Limit:2s Memory Limit:64MByte

Submissions:257Solved:73

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
32 2 21 15 1 41 2 3 4 54 10 31 2 3 4
SAMPLE OUTPUT

1015

源代码:

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;typedef long long ll;int ans[200005];int main(){ int t; int n,m,k; int temp; ll sum; scanf("%d",&t); while(t--) { scanf("%d%d%d",&n,&m,&k); sum = 0; memset(ans,0x3f3f3f3f,sizeof(ans)); for(int i = 0; i < n; i++) scanf("%d",&ans[i]); for(int i = 0; i < n; i++) { if(ans[i]

转载地址:http://txjyz.baihongyu.com/

你可能感兴趣的文章
mysql 删除日志文件详解
查看>>
mysql 判断表字段是否存在,然后修改
查看>>
MySQL 到底能不能放到 Docker 里跑?
查看>>
mysql 前缀索引 命令_11 | Mysql怎么给字符串字段加索引?
查看>>
MySQL 加锁处理分析
查看>>
mysql 协议的退出命令包及解析
查看>>
mysql 参数 innodb_flush_log_at_trx_commit
查看>>
mysql 取表中分组之后最新一条数据 分组最新数据 分组取最新数据 分组数据 获取每个分类的最新数据
查看>>
MySQL 命令和内置函数
查看>>
MySQL 和 PostgreSQL,我到底选择哪个?
查看>>
mysql 四种存储引擎
查看>>
MySQL 在并发场景下的问题及解决思路
查看>>
MySQL 在控制台插入数据时,中文乱码问题的解决
查看>>
MySQL 基础架构
查看>>
MySQL 基础模块的面试题总结
查看>>
MySQL 处理插入重主键唯一键重复值办法
查看>>
MySQL 备份 Xtrabackup
查看>>
mysql 复杂查询_mysql中复杂查询
查看>>
mYSQL 外键约束
查看>>
mysql 多个表关联查询查询时间长的问题
查看>>