链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883

TIANKENG’s restaurant

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 566    Accepted Submission(s): 267

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
 
Source

---------------------------------------------------------------------

 #include <stdio.h>
#include <stdlib.h>
#include <string.h> int main()
{
int str[];
int n,m,i,j,k,t,num,hh1,hh2,mm1,mm2;
scanf("%d",&n);
while(n--)
{
memset(str,,sizeof(str));
scanf("%d",&m);
for(i=;i<m;i++)
{
scanf("%d %d:%d %d:%d",&num,&hh1,&mm1,&hh2,&mm2);
hh1=hh1*+mm1;
hh2=hh2*+mm2;
str[hh1]+=num;
str[hh2]-=num;//printf("%d%d^^",str[hh1],str[hh2]);
}
int maxx=,cas=;
for(i=;i<=;i++)
{
cas+=str[i];
if(cas>maxx)
{
maxx=cas;
}
}
printf("%d\n",maxx);
}
return ;
}

hdu 4883 思维题的更多相关文章

  1. hdu 5014 思维题/推理

    http://acm.hdu.edu.cn/showproblem.php?pid=5014 从小数開始模拟找方法规律,然后推广,尤其敢猜敢尝试,错了一种思路继续猜-----这是一种非常重要的方法啊 ...

  2. Just Random HDU - 4790 思维题(打表找规律)分段求解

    Coach Pang and Uncle Yang both love numbers. Every morning they play a game with number together. In ...

  3. HDU 6464 权值线段树 && HDU 6468 思维题

    免费送气球 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submi ...

  4. 朋友HDU - 5963 (思维题) 三种方法

    传送门 题目描述 输入 输出 样例输入 Sample Input 样例输出 Boys win! Girls win! Girls win! Boys win! Girls win! Boys win! ...

  5. Fang Fang HDU - 5455 (思维题)

    Fang Fang says she wants to be remembered. I promise her. We define the sequence FF of strings. F0 = ...

  6. HDU 1029 Ignatius and the Princess IV / HYSBZ(BZOJ) 2456 mode(思维题,~~排序?~~)

    HDU 1029 Ignatius and the Princess IV (思维题,排序?) Description "OK, you are not too bad, em... But ...

  7. HDU 6298.Maximum Multiple-数学思维题(脑子是个好东西,可惜我没有) (2018 Multi-University Training Contest 1 1001)

    暑假杭电多校第一场,这一场是贪心场,很多贪心的题目,但是自己太菜,姿势挫死了,把自己都写吐了... 2018 Multi-University Training Contest 1 HDU6298.M ...

  8. hdu5325 树的思维题

    pid=5325">http://acm.hdu.edu.cn/showproblem.php? pid=5325 Problem Description Bobo has a tre ...

  9. zoj 3778 Talented Chef(思维题)

    题目 题意:一个人可以在一分钟同时进行m道菜的一个步骤,共有n道菜,每道菜各有xi个步骤,求做完的最短时间. 思路:一道很水的思维题, 根本不需要去 考虑模拟过程 以及先做那道菜(比赛的时候就是这么考 ...

随机推荐

  1. select、poll、epoll之间的区别

    select.poll.epoll之间的区别总结[整理]   select,poll,epoll都是IO多路复用的机制.I/O多路复用就通过一种机制,可以监视多个描述符,一旦某个描述符就绪(一般是读就 ...

  2. 【python cookbook】【数据结构与算法】20.将多个映射合并为单个映射

    问题:在逻辑上将多个字典或映射合并为一个单独的映射结构,以此执行某些特定的操作,比如查找值或者检查键是否存在 解决方案:利用collections模块中的ChainMap类 ChainMap可接受多个 ...

  3. 关于web开发前端h5框架的选择

    关于web开发前端h5框架的选择 看了很多移动版框架都是基于app混合式开发的,不是单独h5网站的基于h5开发的web框架从组件丰富度,兼容性,相关教程来说bootstrap还是最好的react和vu ...

  4. bootstrap实现 手机端滑动效果,滑动到下一页,jgestures.js插件

    bootstrap能否实现 手机端滑动效果,滑动到下一页 jgestures.js插件可以解决,只需要引入一个JS文件<script src="js/jgestures.min.js& ...

  5. PHP用substr截取字符串出现中文乱码问题用mb_substr

    PHP用substr截取字符串出现中文乱码问题用mb_substr实例:mb_substr('截取中文乱码问题测试',0,5, 'utf-8'); 语法 : string substr (string ...

  6. TI BLE CC2541的I2C主模式

    由于要写TM1680, 写命令跟写数据, 所以需要使用CC2541的I2C, 2541是有硬件I2C的. tm1680.c: #include "tm1680.h" //TM168 ...

  7. hide your website's wordpress info/path/way

    Hide Wordpress Info of your website plugin hide-wp 使用apache语句和wp方法重写 但这个插件有个局限就是,你的网站使用的wordpress的话, ...

  8. (个人)读取A.CSV修改它的某列,写入B.CSV

    #!/usr/bin/perl -wuse strict;use warnings;use Tie::File; open(IN_FILE,"<E:/Hzj_works/test1.c ...

  9. Java学习网站

    黑马: http://bbs.itheima.com/forum.php 考试网站: http://www.nowcoder.com/ 牛客网 比较专业的学习技术网站: http://www.ibm. ...

  10. POJ 3237:Tree(树链剖分)

    http://poj.org/problem?id=3237 题意:树链剖分.操作有三种:改变一条边的边权,将 a 到 b 的每条边的边权都翻转(即 w[i] = -w[i]),询问 a 到 b 的最 ...