TIANKENG’s restaurant
来源:互联网 发布:linux chrome 命令行 编辑:程序博客网 时间:2024/06/06 03:48
bc
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): 379 Accepted Submission(s): 188
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.
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
226 08:00 09:005 08:59 09:5926 08:00 09:005 09:00 10:00
Sample Output
116
比赛的时候想了很久
给时间进来,就+k,到了时间久-k
#include<iostream>using namespace std;int a[30000];int main(){int N;cin>>N;while(N--){int n;cin>>n;memset(a,0,sizeof(a));int h,m;int k;while(n--){cin>>k;scanf("%d:%d",&h,&m);a[h*60+m]+=k;scanf("%d:%d",&h,&m);a[h*60+m]-=k;}int ans=a[0];for(int i=1;i<28*60;i++){a[i]+=a[i-1];if(a[i]>ans)ans=a[i];if(a[i]>0)cout<<a[i]<<endl;}//printf("%d\n",ans);} return 0;}
0 0
- TIANKENG’s restaurant
- TIANKENG’s restaurant
- HDU_4883 TIANKENG’s restaurant
- hdu TIANKENG’s restaurant
- hdoj4883 TIANKENG’s restaurant
- TIANKENG’s restaurant
- HDOJ TIANKENG’s restaurant
- TIANKENG’s restaurant
- 4883 TIANKENG’s restaurant
- hd4883 TIANKENG’s restaurant
- TIANKENG’s restaurant--hdu4883
- TIANKENG’s restaurant
- B - TIANKENG’s restaurant
- TIANKENG’s restaurant
- TIANKENG’s restaurant
- TIANKENG’s restaurant
- TIANKENG’s restaurant HDU
- HDOJ 4883 TIANKENG’s restaurant
- 分类和聚类的区别及各自的常见算法
- centos6.5安装php的mcrypt扩展
- Eclipse 安装最新SVN插件
- CodeForces 451B Sort the Array(排序,逆序)
- 16种动画切换效果
- TIANKENG’s restaurant
- 第五章 语句
- 神经网络之BP神经网络
- iOS UITableView 优化
- android NDk 驱动以及androidcontrol界面开发
- Linux进程—task_struct
- zoj 3733 skycity
- Android通过http协议POST传输方式如下: (转)
- linux学习笔记鸟哥的私房菜(二)-文件与目录管理