链接: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. eclipse字体颜色设置

    修改编码:window-->perference--->General--> Configure.--> Configure.-->workspace修改编辑背景色:wi ...

  2. 161104、NoSQL数据库:key/value型之levelDB介绍及java实现

    简介:Leveldb是一个google实现的非常高效的kv数据库,能够支持billion级别的数据量了. 在这个数量级别下还有着非常高的性能,主要归功于它的良好的设计.特别是LSM算法.LevelDB ...

  3. Sublime Text设置快捷键让html文件在浏览器打开

    一.安装View In Browser插件 快捷键 Ctrl+Shift+P(菜单栏Tools->Command Paletter),输入 pcip选中Install Package并回车,输入 ...

  4. Linux I2C工具查看配置I2C设备【转】

    转自:http://blog.chinaunix.net/uid-26895763-id-3478882.html 在處理音訊相關的問題時,我通常會找個方法來讀寫codec中register的值.幸好 ...

  5. TreeView htc 改写

    call the function loadTree(treeviewId) when body is loaded <body onload="loadTree('tvSelect' ...

  6. Pascal's Triangle

    class Solution { public: vector<vector<int>> generate(int numRows) { vector<vector< ...

  7. 使用crontab不能正常执行的问题

    crontab -l:   列出当前用户的crontab列表crontab -e:   以vi打开crontab文件,可以进行编辑.如果需要加新的自启动项目,可以在此进行添加后再输入:wq 保存. & ...

  8. Oracle中instr 函数的详解

    INSTR    (源字符串, 目标字符串, 起始位置, 匹配序号)    在Oracle/PLSQL中,instr函数返回要截取的字符串在源字符串中的位置.只检索一次,就是说从字符的开始    到字 ...

  9. 凯撒加密解密(java字母移位)

    1.设计思想:加密就是将字符数据转化为ASC码表中的数字,a—w之间通过加3之后再转化为字符型输出,x—z之间通过转化为ASC码表中的数字后减去23再转化为字符型输出.解密就是将字符数据转化为ASC码 ...

  10. randperm函数

    randperm功能是随机打乱一个数字序列. 语法格式: y = torch.randperm(n) y是把1到n这些数随机打乱得到的一个数字序列. th> torch.randperm() [ ...