博客
关于我
玲珑学院-ACM比赛1014 - Absolute Defeat
阅读量:430 次
发布时间: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/

你可能感兴趣的文章
Elasticsearch & Kibana & Filebeat开启SSL通信
查看>>
ElasticSearch - DSL查询文档语法,以及深度分页问题、解决方案
查看>>
ElasticSearch - 在 微服务项目 中基于 RabbitMQ 实现 ES 和 MySQL 数据异步同步(考点)
查看>>
ElasticSearch - 基于 docker 部署 es、kibana,配置中文分词器、扩展词词典、停用词词典
查看>>
ElasticSearch - 基于 DSL 、JavaRestClient 实现数据聚合
查看>>
ElasticSearch - 基于 JavaRestClient 操作索引库和文档
查看>>
ElasticSearch - 基于 JavaRestClient 查询文档(match、精确、复合查询,以及排序、分页、高亮)
查看>>
ElasticSearch - 基于 “黑马旅游” 案例,实现搜索框、分页、条件过滤、附近酒店、广告置顶功能
查看>>
ElasticSearch - 索引库和文档相关命令操作
查看>>
elasticsearch 7.7.0 单节点配置x-pack
查看>>
ElasticSearch 中 REST API 详解
查看>>
Elasticsearch 之(16)_filter执行原理深度剖析(bitset机制与caching机制)
查看>>
Elasticsearch 时区问题
查看>>
Elasticsearch 索引字段类型为text,添加keyword类型操作
查看>>
Elasticsearch(四) es出现的问题:填坑
查看>>
elasticsearch-5.1.1 安装的问题
查看>>
Elasticsearch7.3.1启动指定JDK11
查看>>
Elasticsearch下载安装
查看>>
Elasticsearch入门教程(Elasticsearch7,linux)
查看>>
elasticsearch的helpers.bulk和es_client.bulk的用法
查看>>