TIANKENG’s restaurant HDU
来源:互联网 发布:怎样注册一个域名 编辑:程序博客网 时间:2024/05/18 02:29
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
这题的解法实在太巧妙,记录
#include<iostream>#include<cstdio>#include<cmath>#include<algorithm>#include<cstring>#include<vector>using namespace std;typedef long long ll;int time[1445];int main(){ int t; int n; int num,h1,m1,h2,m2; cin>>t; while(t--) { memset(time,0,sizeof(time)); cin>>n; while(n--) { scanf("%d%d:%d%d:%d",&num,&h1,&m1,&h2,&m2); int time1=h1*60+m1; int time2=h2*60+m2; time[time1]+=num; time[time2]-=num; } int maxn=0; for(int i=1;i<=1440;i++) { time[i]+=time[i-1]; maxn=max(maxn,time[i]); } cout<<maxn<<endl; } return 0;}
- hdu TIANKENG’s restaurant
- TIANKENG’s restaurant HDU
- HDU 4883 TIANKENG’s restaurant
- hdu 4883 TIANKENG’s restaurant
- HDU 4883 TIANKENG’s restaurant
- hdu 4883 TIANKENG’s restaurant
- hdu 4883 TIANKENG’s restaurant
- HDU lines && TIANKENG’s restaurant
- HDU-4883-TIANKENG’s restaurant
- hdu 4883 TIANKENG’s restaurant
- HDU 4883 TIANKENG’s restaurant
- HDU 4883 TIANKENG’s restaurant
- hdu 4883 (Best Coder) TIANKENG’s restaurant
- HDU 4883 TIANKENG’s restaurant(区间选点)
- hdu 4883 TIANKENG’s restaurant(区间选点)
- 【HDU】4883 TIANKENG’s restaurant 标记法
- hdu 4886 TIANKENG’s restaurant(Ⅱ) 字符串
- HDU 4886 TIANKENG’s restaurant(Ⅱ)
- Centos 7防火墙firewalld开放80端口
- Android Studio 如何设置logcat(控制台)的缓存大小,增加logcat控制台条数
- 零基础入门深度学习(2)
- 单表的CURD操作(使用mapper动态代理)
- 蓝桥杯 ALGO-104 算法训练 阿尔法乘积
- TIANKENG’s restaurant HDU
- 测试
- jstl c:choose>、<c:when>和<c:otherwise>标签
- 零基础入门深度学习(3)
- 微信扫码支付
- mysql中int、bigint、smallint 和 tinyint的区别详细介绍
- 时间复杂度(数据结构笔记)
- 守护进程
- 零基础入门深度学习(4)