杭电 4883 TIANKENG’s restaurant (求饭店最少需要座椅)
Description
Input
Each cases has a positive integer n(1<=n<=10000), which means n groups of customer. Then following n lines, each line there is a positive integer Xi(1<=Xi<=100), referring to the sum of the number of the ith group people, and the arriving time STi and departure time Edi(the time format is hh:mm, 0<=hh<24, 0<=mm<60), Given that the arriving time must be earlier than the departure time.
Pay attention that when a group of people arrive at the restaurant as soon as a group of people leaves from the restaurant, then the arriving group can be arranged to take their seats if the seats are enough.
Output
Sample Input
Sample Output
求每一刻饭店的人数,找出最大值
#include<cstdio>
int main()
{
int t,n,i,j,h1,h2,m1,m2,p;
scanf("%d",&t);
while(t--)
{
int b[]={};
int max=;
scanf("%d",&n);
for(i=;i<n;i++)
{
scanf("%d %d:%d %d:%d",&p,&h1,&m1,&h2,&m2);
h1=h1*+m1;
h2=h2*+m2;
for(j=h1;j<h2;j++)
{
b[j]+=p;
max=max>b[j]?max:b[j];
}
}
printf("%d\n",max); }
}
杭电 4883 TIANKENG’s restaurant (求饭店最少需要座椅)的更多相关文章
- 高手看了,感觉惨不忍睹——关于“【ACM】杭电ACM题一直WA求高手看看代码”
按 被中科大软件学院二年级研究生 HCOONa 骂为“误人子弟”之后(见:<中科大的那位,敢更不要脸点么?> ),继续“误人子弟”. 问题: 题目:(感谢 王爱学志 网友对题目给出的翻译) ...
- HDOJ 4883 TIANKENG’s restaurant
称号: TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Ja ...
- hdoj 4883 TIANKENG’s restaurant【贪心区间覆盖】
TIANKENG’s restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/O ...
- HDU 4883 TIANKENG’s restaurant Bestcoder 2-1(模拟)
TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/O ...
- HDU 4883 TIANKENG’s restaurant
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883 解题报告:一家餐馆一天中有n波客人来吃饭,第 i 波 k 客人到达的时间是 s ,离开时的时间 ...
- HDU 4883 TIANKENG’s restaurant (贪心)
链接:pid=4883">带我学习.带我飞 第一次BC,稳挂,WA n多次.今天又一次做了一下 略挫 #include <iostream> #include <cs ...
- 【ACM】杭电ACM题一直WA求高手看看代码
数据测试了好几个都没问题,可以就是WA不让过,检测了2个小时还是没发现有什么问题T_T!!求高手看看代码,小弟在此谢谢各位哦! #include <stdio.h> #include &l ...
- 杭电 2035 (快速幂) 求A^B的最后三位数表示的整数
Description 求A^B的最后三位数表示的整数. 说明:A^B的含义是“A的B次方” Input 输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B&l ...
- 杭电ACM分类
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...
随机推荐
- 实验 - cut的应用
题目一: 1.1 创建一个通讯录 vi phone.txt #进行编辑 cat phone.txt #查看内容 2.1 取出手机号码 cut -f phone.txt 3.1 取出手机前三位 cut ...
- jQuery 动作效果
隐藏和显示 jQuery hide() 和 show() 通过 jQuery,您可以使用 hide() 和 show() 方法来隐藏和显示 HTML 元素: jQuery toggle() 通过 jQ ...
- 数学 Codeforces Round #308 (Div. 2) B. Vanya and Books
题目传送门 /* 水题:求总数字个数,开long long竟然莫名其妙WA了几次,也没改啥又对了:) */ #include <cstdio> #include <iostream& ...
- 转-Mac下Apache Tomcat安装配置
ava Web如果稍微知道一点,一般对Tomcat都不会陌生,Apache是普通服务器,本身只支持html即普通网页,可以通过插件支持PHP,还可以与Tomcat连通(单向Apache连接Tomcat ...
- IOS 绘制PDF -转
-(void)createPdf:(UIImage *)img andText:(NSString *)text{ NSArray *paths = NSSearchPathForDirectorie ...
- Kali linux 2016.2(Rolling) 的详细安装(图文教程)附安装VMare Tools 增强工具
写在前面的话 因读研期间,实验室团队需要,所以,接触上了Kali Linux,需去获得网络安全方面的数据,即数据和信息收集.以便为后续的数据处理和分析,准备! 用到hadoop和spark.机器学习等 ...
- es6核心特性-数组扩展
1. Array.from() : 将伪数组对象或可遍历对象转换为真数组 如果一个对象的所有键名都是正整数或零,并且有length属性,那么这个对象就很像数组,称为伪数组.典型的伪数组有函数的argu ...
- Android BitmapFactory.decodeFile(filePath, options) 返回 Null 6.0权限
今天在做拍照上传的时候遇到个问题,根据路径获取Bitmap 失败,一直返回空,以为这个路径获取Bitmap代码久经考验,不怀疑它,找参数传入是否正确,初步怀疑是 filePath 没传进去,打印 fi ...
- GridView 中绑定DropDownList ,下拉框默认选中Label的值
在GridView中,我们 有时候要绑定值. 前台绑定的代码可以这样 <asp:TemplateField HeaderText="当前状态" ItemStyle-Horiz ...
- 【Python】列表解析表达式
1.语法 [expression for iter_val in iterable] [expression for iter_val in iterable if cond_expr] 2.示例 s ...