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

Problem 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

以分钟为单位 直接模拟即可了   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(模拟)的更多相关文章

  1. HDU 4883 TIANKENG’s restaurant

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

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

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

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

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

  4. HDOJ 4883 TIANKENG’s restaurant

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

  5. HDU 4886 TIANKENG’s restaurant(Ⅱ) ( 暴力+hash )

    TIANKENG’s restaurant(Ⅱ) Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 130107/65536 K (Ja ...

  6. 杭电 4883 TIANKENG’s restaurant (求饭店最少需要座椅)

    Description TIANKENG manages a restaurant after graduating from ZCMU, and tens of thousands of custo ...

  7. HDU 4886 TIANKENG’s restaurant(Ⅱ) hash+dfs

    题意: 1.找一个字符串s使得 s不是给定母串的子串 2.且s要最短 3.s在最短情况下字典序最小 hash.,,结果t掉了...加了个姿势怪异的hash值剪枝才过.. #include <cs ...

  8. hdu 4883 思维题

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883 TIANKENG’s restaurant Time Limit: 2000/1000 MS (Ja ...

  9. hdu 4885 TIANKENG’s travel(bfs)

    题目链接:hdu 4885 TIANKENG's travel 题目大意:给定N,L,表示有N个加油站,每次加满油能够移动距离L,必须走直线,可是能够为斜线.然后给出sx,sy,ex,ey,以及N个加 ...

随机推荐

  1. [BZOJ1069][SCOI2007]最大土地面积 凸包+旋转卡壳

    1069: [SCOI2007]最大土地面积 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 3669  Solved: 1451[Submit][Sta ...

  2. FZU-2267 The Bigger the Better(字符串,模拟)

     Problem 2267 The Bigger the Better Accept: 132    Submit: 935Time Limit: 1500 mSec    Memory Limit ...

  3. 如何正确使用const(常量),define(宏)

    前言 在开发中,也许我们会经常使用到宏定义,或者用const修饰一些数据类型,经常有开发者不知道怎么正确使用,导致项目中乱用宏定义与const修饰符.本篇主要介绍在开发中怎么正确使用const与def ...

  4. 【bzoj2393】【Cirno的完美算数教室】容斥原理的剪枝应用

    (上不了p站我要死了,侵权度娘背锅) 在用容斥定理时,常常会用到dfs的形式,如果枚举完所有的情况可能会超时,其剪枝的优化很是重要. Description ~Cirno发现了一种baka数,这种数呢 ...

  5. [POI2010]Beads

    题目大意: 给定一个长度为$n(n\leq200000)$的串$S_{1\sim n}$,选择一个$l$,从$S_1$开始,将$S$分为连续的若干段,使得每一段长度为$l$.令$k$为分出来不同的子串 ...

  6. 基于Rebound制造绚丽的动画效果-入门篇

    基于Rebound制造绚丽的动画效果-入门篇 Rebound是什么? Rebound是一个来自 Facebook 公司的 Java物理和动画库.Rebound spring 模型可用于创建动画,让你感 ...

  7. http://blog.csdn.net/muzizongheng/article/details/46795243

    http://blog.csdn.net/muzizongheng/article/details/46795243

  8. 使用JProfiler分析定位java内存泄露memory leak

    使用jprofiler远程profile JBoss应用服务器 项目中发现JBoss出现内存泄露, 从2G一直涨到3.5G左右 开始考虑使用jmap dump出内存来, 在用jhap打开浏览器分析. ...

  9. 联想T470设置U盘启动

    联想T470设置U盘启动 学习了:http://www.udaxia.com/upqd/10092.html # F12 in Enter in USB HDD 如果不行: App Menu > ...

  10. OpenCV入门笔记(三) 图片处理

    OpenCV中提供了非常多处理图片的强大函数,能够对非常多格式的图片 加特效.有点实现Photoshop里的工具的感觉. 以下先介绍一些简单和常见的特效. 二值化(Image Threshold) 參 ...