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 ...
随机推荐
- 数据库防火墙如何防范SQL注入行为
SQL注入是当前针对数据库安全进行外部攻击的一种常见手段.现有主流应用大多基于B/S架构开发,SQL注入的攻击方式正是利用web层和通讯层的缺陷对数据库进行外部恶意攻击.将SQL命令巧妙的插入通讯的交 ...
- Java学习笔记(十五)——javadoc学习笔记和可能的注意细节
[前面的话] 这次开发项目使用jenkins做持续集成,PMD检查代码,Junit做单元测试,还会自动发邮件通知编译情况,会将javadoc生成的文档自动发到一个专门的服务器上面,每个人都可以看,所以 ...
- node的实践(项目三)
渲染前台的方式. <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" ...
- redis学习笔记——(2)
4.Redis中的string类型 String类型是最简单的类型,一个Key对应一个Value,String类型是二进制安全的.Redis的String可以包含任何数据,比如jpg图片或者序列化的对 ...
- Linq之Linq to Sql
目录 写在前面 系列文章 Linq to sql 总结 写在前面 上篇文章介绍了linq to xml的相关内容,linq to xml提供一种更便捷的创建xml树,及查询的途径.这篇文章将继续介绍l ...
- [设计模式] javascript 之 工厂方法模式
1. 简单工厂模式 说明:就是创建一个工厂类,里面实现了所对同一个接口的实现类的创建. 但是好像JavaScript 好像没有 接口 这号东西,所以我们去掉接口这个层; 当然,我们这里的 实现类 下的 ...
- 拦路虎:jQuery
1. color设置无效的问题! $("#subscribe").hover(function(){ var $this = $("#subscribe .subsc ...
- SSH框架整合配置所需JAR包(SSH整合)
转载于:http://www.cnblogs.com/kaige123/p/5719662.html Hibernate Jar: 1.hibernate3.jar,这个是hibernate3.0的核 ...
- php 判断是否get传值的参数是否存在
if(is_array($_GET)&&count($_GET)>0)//先判断是否通过get传值了 { if(isset($_GET["id&qu ...
- 在Web Service中傳送Dictionary
有個需求,想在Web Service中傳遞Dictionary<string, string>參數,例如: 排版顯示純文字 [WebMethod] public Dictionary< ...