Description

TIANKENG manages a restaurant after graduating from ZCMU, and tens of thousands of customers come to have meal because of its delicious dishes. Today n groups of customers come to enjoy their meal, and there are Xi persons in the ith group in sum. Assuming that each customer can own only one chair. Now we know the arriving time STi and departure time EDi of each group. Could you help TIANKENG calculate the minimum chairs he needs to prepare so that every customer can take a seat when arriving the restaurant?
 

Input

The first line contains a positive integer T(T<=100), standing for T test cases in all.

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

For each test case, output the minimum number of chair that TIANKENG needs to prepare.
 

Sample Input

2
2
6 08:00 09:00
5 08:59 09:59
2
6 08:00 09:00
5 09:00 10:00
 

Sample Output

11
6

求每一刻饭店的人数,找出最大值

 #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 (求饭店最少需要座椅)的更多相关文章

  1. 高手看了,感觉惨不忍睹——关于“【ACM】杭电ACM题一直WA求高手看看代码”

    按 被中科大软件学院二年级研究生 HCOONa 骂为“误人子弟”之后(见:<中科大的那位,敢更不要脸点么?> ),继续“误人子弟”. 问题: 题目:(感谢 王爱学志 网友对题目给出的翻译) ...

  2. HDOJ 4883 TIANKENG’s restaurant

    称号: TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Ja ...

  3. hdoj 4883 TIANKENG’s restaurant【贪心区间覆盖】

    TIANKENG’s restaurant Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/O ...

  4. 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 ...

  5. HDU 4883 TIANKENG’s restaurant

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883 解题报告:一家餐馆一天中有n波客人来吃饭,第 i 波  k 客人到达的时间是 s ,离开时的时间 ...

  6. HDU 4883 TIANKENG’s restaurant (贪心)

    链接:pid=4883">带我学习.带我飞 第一次BC,稳挂,WA n多次.今天又一次做了一下 略挫 #include <iostream> #include <cs ...

  7. 【ACM】杭电ACM题一直WA求高手看看代码

    数据测试了好几个都没问题,可以就是WA不让过,检测了2个小时还是没发现有什么问题T_T!!求高手看看代码,小弟在此谢谢各位哦! #include <stdio.h> #include &l ...

  8. 杭电 2035 (快速幂) 求A^B的最后三位数表示的整数

    Description 求A^B的最后三位数表示的整数. 说明:A^B的含义是“A的B次方”    Input 输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B&l ...

  9. 杭电ACM分类

    杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...

随机推荐

  1. flask框架路由系统

    flask框架的url系统: flask框架的路由系统: flask框架的路由系统使用实例化的route方法来指定: 如: @app.route('/') route函数装饰器可以把一个函数绑定到对应 ...

  2. ural1076 Trash 垃圾

    Description You were just hired as CEO of the local junkyard.One of your jobs is dealing with the in ...

  3. 牛客小白月赛5-J-时间(time) (简单模拟)

    题目描述 Apojacsleam是一个喜欢特殊时刻的人. 他定义了一个时刻,若电子表显示ab:ba(24小时制),则该时刻为“回文时刻”(可以有前导零).例如00:00就是回文时刻. 给定一个时刻,求 ...

  4. 转】R利剑NoSQL系列文章 之 Cassandra

    原博文出自于: http://blog.fens.me/category/%E6%95%B0%E6%8D%AE%E5%BA%93/page/3/ 感谢! R利剑NoSQL系列文章 之 Cassandr ...

  5. 快速体验openstack-用devstack安装openstack

    官网安装说明: --2014年11月15日14:14:21 安装环境:Ubuntu12.04,安装官网的说明遇到了小问题,记录在这里 --http://docs.openstack.org/devel ...

  6. 10.3 Implementing pointers and objects and 10.4 Representing rooted trees

    Algorithms 10.3 Implementing pointers and  objects  and 10.4 Representing rooted trees Allocating an ...

  7. quazip非静态成员。。错误

    转载请注明出处:http://www.cnblogs.com/dachen408/p/7147155.html 问题:quazip非静态成员..错误 解决方案:quazip_global.h  第42 ...

  8. (三)Redis for StackExchange.Redis

    目录 (一)Redis for Windows正确打开方式 (二)Redis for 阿里云公网连接 (三)Redis for StackExchange.Redis StackExchange.Re ...

  9. (转)Spring中的事务操作

    http://blog.csdn.net/yerenyuan_pku/article/details/70024364 事务的回顾 什么是事务 事务是逻辑上的一组操作,组成这组操作的各个逻辑单元,要么 ...

  10. 泛型术语:占位类型placeholder

    Here’s a generic version of the same code: struct Stack<Element> { var items = [Element]() mut ...