UESTC 1817 Complete Building the Houses
| Time Limit: 2000MS | Memory Limit: 65535KB | 64bit IO Format: %lld & %llu |
Description
Bear has a large, empty ground for him to build a home. He decides to build a row of houses, one after another, say n in total.
The houses are designed with different height. Bear has m workers in total, and the workers must work side by side. So at a time bear can choose some continuous houses, no more than m, and add their heights by one, this takes one day to finish.
Given the designed height for each house, what is the minimum number of days after which all the houses’ heights are no less than the original design?
Input
The first line of input contains a number T, indicating the number of test cases. (T<=50)
For each case, the first line contains two integers n and m: the number of houses and the number of workers. The next line comes with n non-negative numbers, they are the heights of the houses from left to right. (1<=n, m<=100,000, each number will be less than 1,000,000,000)
Output
For each case, output “Case #i: “ first. (i is the number of the test case, from 1 to T). Then output the days when bear’s home can be built.
Sample Input
2
3 3
1 2 3
3 3
3 2 1
Sample Output
Case #1: 3
Case #2: 3
Source
|
#include <iostream>
#include <cstdio> #include <cstring> using namespace std; int sum[110000]; int main() |
* This source code was highlighted by YcdoiT. ( style: Codeblocks )
UESTC 1817 Complete Building the Houses的更多相关文章
- cdoj 04 Complete Building the Houses 暴力
Complete Building the Houses Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/# ...
- MINIX3 保护模式分析
3.1 INTEL 保护模式概要 先要说明一个问题:不是 MINIX3 一定要设置这个保护模式,但是在 386 平台上, 引入了这个保护模式机制,MINIX3 不得不设立相关保护模式的内容.由于 38 ...
- hdu 3879 Base Station 最大权闭合图
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3879 A famous mobile communication company is plannin ...
- Builder创建者模式
http://www.codeproject.com/Articles/42415/Builder-Design-Pattern In Elizabeth's day care center, the ...
- 原始启动log&新log
root@Taiyear:/# U-Boot 1.1.3 (Dec 27 2013 - 09:14:28) SoC:MediaTek MT7620 DRAM: Memory Testing..655 ...
- hdu4296 贪心
E - 贪心 Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:32768KB 64bit I ...
- hdu 4296 Buildings(贪婪)
主题链接:http://acm.hdu.edu.cn/showproblem.php? pid=4296 Buildings Time Limit: 5000/2000 MS (Java/Others ...
- OpenWrt中对USB文件系统的操作, 以及读写性能测试
参考 http://h-wrt.com/en/doc/flash 1. 查看usb存储在启动日志中的信息 # dmesg [ 5.720000] usbcore: registered new int ...
- LS1021ATWR开发板启动日志分析
一.背景 LS1021ATWR开发板运行官方的openwrt系统 二.日志分析 2.1 linux相关日志 root@OpenWrt:/# reboot 重启 root@OpenWrt:/# [ 2 ...
随机推荐
- 工作随笔——CentOS6.4支持rz sz操作
yum一句话解决: yum -y install lrzsz
- CUDA编程学习(三)
我们知道一个grid包含多个block,而一个block又包含多个thread,下面将是如何进行下thread中的并行. /**** Splot a block into parallel threa ...
- SDAccel-FPGA将带来至多25倍单位功耗性能提升
很久没有看FPGA了,本来想继续学习HLS,就上Xilinx的网站看了看.结果发现了SDx 开发环境,很新的一个东西.由于我对这方面了解不多,本篇博文仅仅只是资料的整合和介绍. 1.SDx开发环境 X ...
- Thrift搭建分布式微服务(四)
第一篇 <连接配置> 第二篇 <连接池> 第三篇 <标准通信> 第四篇 快速暴露接口 之前的文章,我们介绍了如何使用连接池管理Thrift节点,以及使用Thri ...
- IT男的”幸福”生活"续1
IT男的”幸福”生活"续1 我和LL开始下步追妹计划...... 知彼知已,方能把握机会.没想到孙子兵法太给力了,据LL了解,MM(她)是湖北人,找对象一般不会考虑外省的.高度165左右,相 ...
- Mediator Pattern --中介者模式原理及实现(C++)
主要参考<大话设计模式>和<设计模式:可复用面向对象软件的基础>两本书.本文介绍中介者模式的实现. 中介者模式:What it is:Define an object that ...
- 如何使用impress.js做一个网页版本的PPT
blockquote{font-size: 18px;line-height:1.5;margin:0;}line-height: 1.5; 要做一个网站制作规范培训,之前村长做过一次培训,但是后来一 ...
- C#中值类型和引用类型
本文将介绍C#类型系统中的值类型和引用类型,以及两者之间的一些区别.同时,还会介绍一下装箱和拆箱操作. 值类型和引用类型 首先,我们看看在C#中哪些类型是值类型,哪些类型是引用类型. 值类型: 基础数 ...
- [设计模式] Javascript 之 外观模式
外观模式说明 说明:外观模式是用于由于子系统或程序组成较复杂而提供的一个高层界面接口,使用客户端更容易访问底层的程序或系统接口; 外观模式是我们经常使用遇到的模式,我们经常涉及到的功能,可能需要涉及到 ...
- DOM(二)使用DOM
在了解DOM(文本对象模型)的框架和节点后,最重要的是使用这些节点处理html网页 对于一个DOM节点node,都有一系列的属性和方法可以使用.常用的有下表. 完善:http://www.w3scho ...