【CUGBACM15级BC第二场 A】hdu 4883 TIANKENG’s restaurant
来源:互联网 发布:上海金慧软件 编辑:程序博客网 时间:2024/06/08 16:48
TIANKENG’s restaurant
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 3257 Accepted Submission(s): 1215
Total Submission(s): 3257 Accepted Submission(s): 1215
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
题目大意:一间餐厅,给你每组客人的人数和来的时间,离开的时间,问最少需要的椅子。
#include <iostream>#include <set>#include <map>#include <stack>#include <cmath>#include <queue>#include <cstdio>#include <bitset>#include <string>#include <vector>#include <iomanip>#include <cstring>#include <algorithm>#include <functional>#define PI acos(-1)#define eps 1e-8#define inf 0x3f3f3f3f#define debug(x) cout<<"---"<<x<<"---"<<endltypedef long long ll;using namespace std;int a[1600];int main(){ int t; cin >> t; while (t--) { memset(a, 0, sizeof(a)); int n; cin >> n; int x, h1, h2, m1, m2; for (int i = 0; i < n; i++) { scanf("%d%d:%d%d:%d", &x, &h1, &m1, &h2, &m2); int start = 60 * h1 + m1; int endd = 60 * h2 + m2; for (int k = start; k < endd; k++) { a[k] += x; } } int ans = 0; for (int i = 0; i < 1600; i++) { ans = max(ans, a[i]); } cout << ans << endl; } return 0;}
阅读全文
0 0
- 【CUGBACM15级BC第二场 A】hdu 4883 TIANKENG’s restaurant
- 【CUGBACM15级BC第二场 B】hdu 4884 TIANKENG’s rice shop
- 【CUGBACM15级BC第29场 A】hdu 5170 GTY's math problem
- 【CUGBACM15级BC第33场 A】hdu 5186 zhx's submissions
- 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-4883-TIANKENG’s restaurant
- hdu 4883 TIANKENG’s restaurant
- HDU 4883 TIANKENG’s restaurant
- HDU 4883 TIANKENG’s restaurant
- 【CUGBACM15级BC第15场 A】hdu 5083 Love
- 【CUGBACM15级BC第17场 A】hdu 5100 Chessboard
- 【CUGBACM15级BC第23场 A】hdu 5146 Sequence
- 【CUGBACM15级BC第8场 A】hdu 4989 Summary
- 【CUGBACM15级BC第五场 A】hdu 4956 Poor Hanamichi
- libopencv_videoio.so: undefined reference to `av_free@LIBAVUTIL_52'
- web开发中获取的各种高度和宽度
- Java基础——JSP(二)
- 【备忘】2017年极客学院大数据工程师全套 视频 代码 课件
- PL/SQL 乱码问题
- 【CUGBACM15级BC第二场 A】hdu 4883 TIANKENG’s restaurant
- Linux -soname深入理解
- 图片压缩工具
- 【C/C++开发】C++11的模板类型判断——std::is_same和std::decay
- 用 Scikit-Learn 和 Pandas 学习线性回归
- Android蓝牙BLE开发(一)-基本原理
- Unity3D导弹追踪目标(三维效果)
- 前端奇淫技巧(一)之前端遇到需要数据遍历的如何处理
- websocket 实现服务器日志实时反馈(linux 环境)