HDU 4883 TIANKENG’s restaurant Bestcoder 2-1(模拟)
TIANKENG’s restaurant
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s): 0
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?
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.
For each test case, output the minimum number of chair that TIANKENG needs to prepare.
2
2
6 08:00 09:00
5 08:59 09:59
2
6 08:00 09:00
5 09:00 10:00
11
6
以分钟为单位 直接模拟即可了 peo[i]代表第i分钟的人 第i组人第si分钟进来 第so分钟出去
那么j从si到so peo[j]都加上这组的人数 最后看第几分钟人最多就是答案了
#include<cstdio>
#include<cstring>
using namespace std;
const int N = 1441;
int hi, ho, mi, mo, si, so, t, n, ans, p, peo[N]; int main()
{
scanf ("%d", &t);
while (t--)
{
scanf ("%d", &n);
memset (peo, 0, sizeof (peo));
for (int i = 1; i <= n; ++i)
{
scanf ("%d %d:%d %d:%d", &p, &hi, &mi, &ho, &mo);
si = hi * 60 + mi;
so = ho * 60 + mo;
for (int j = si; j < so; ++j)
peo[j] += p;
}
for (int i = ans = 1; i < N; ++i)
if (peo[i] > ans) ans = peo[i];
printf ("%d\n", ans);
}
return 0;
}
HDU 4883 TIANKENG’s restaurant Bestcoder 2-1(模拟)的更多相关文章
- 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 ...
- hdoj 4883 TIANKENG’s restaurant【贪心区间覆盖】
TIANKENG’s restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/O ...
- HDOJ 4883 TIANKENG’s restaurant
称号: TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Ja ...
- HDU 4886 TIANKENG’s restaurant(Ⅱ) ( 暴力+hash )
TIANKENG’s restaurant(Ⅱ) Time Limit: 16000/8000 MS (Java/Others) Memory Limit: 130107/65536 K (Ja ...
- 杭电 4883 TIANKENG’s restaurant (求饭店最少需要座椅)
Description TIANKENG manages a restaurant after graduating from ZCMU, and tens of thousands of custo ...
- HDU 4886 TIANKENG’s restaurant(Ⅱ) hash+dfs
题意: 1.找一个字符串s使得 s不是给定母串的子串 2.且s要最短 3.s在最短情况下字典序最小 hash.,,结果t掉了...加了个姿势怪异的hash值剪枝才过.. #include <cs ...
- hdu 4883 思维题
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883 TIANKENG’s restaurant Time Limit: 2000/1000 MS (Ja ...
- hdu 4885 TIANKENG’s travel(bfs)
题目链接:hdu 4885 TIANKENG's travel 题目大意:给定N,L,表示有N个加油站,每次加满油能够移动距离L,必须走直线,可是能够为斜线.然后给出sx,sy,ex,ey,以及N个加 ...
随机推荐
- MVC5 WebAPI 跨域处理
问题描述: 在使用ASP.NET的MVC5进行WebAPI开发的时候,在跨域的情况下会报跨域的错, No 'Access-Control-Allow-Origin' header is present ...
- Netty源码学习(二)NioEventLoopGroup
0. NioEventLoopGroup简介 NioEventLoopGroup可以理解为一个线程池,内部维护了一组线程,每个线程负责处理多个Channel上的事件,而一个Channel只对应于一个线 ...
- SpringMVC + Hibernate + MySQL 的简易网页搭建(Dao层 实现篇)
首先在搭建一个网站后台前,需要明确出一个合理的网页搭建的结构框架,即从DB ==> Dao层 ==>Service层 ==>Control层 ==>View层(该层严格意义 ...
- (2)C#工具箱-公共控件2
1.MaskedTextBox 限制填写数据格式的文本框 2.MonthCalendar 用法和DateTimePicker相同 日历 3.NotifIcon (1)添加此控件后,此界面运行时会弹出用 ...
- codebolcks设置自动补全[转]
熟悉使用一些开发类IDE的朋友对代码自动补全一定印象深刻,如Visual studio,eclipse等,我们在程序中定义的那一个个超长的变量函数名只需打出几个字母就可自动补全,但是在codebloc ...
- SQL表操作习题6 36~45题
- 动态路由协议(3)--ospf
1.设置pc ip 网关 192.168.1.1 192.168.1.254 192.168.4.1 192.168.4.254 2.设置路由器 (1)设置接口ip Router(config-/ R ...
- iOS教程:如何使用Core Data – 预加载和引入数据
这是接着上一次<iOS教程:Core Data数据持久性存储基础教程>的后续教程,程序也会使用上一次制作完成的. 再上一个教程中,我们只做了一个数据模型,之后我们使用这个数据模型中的数据创 ...
- DOM系统学习-基础
DOM介绍 DOM介绍: D 网页文档 O 对象,可以调用属性和方法 M 网页文档的树型结构 节点: DOM将树型结构理解为由节点组成. 节点种类: 元素节点.文本节点.属性节点等 查找元 ...
- VUE -- ejs模板的书写
1.EJS是一个简单高效的模板语言,通过数据和模板,可以生成HTML标记文本.可以说EJS是一个JavaScript库,EJS可以同时运行在客户端和服务器端,客户端安装直接引入文件即可,服务器端用np ...