TIANKENG’s restaurant HDU - 4883 (暴力)
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<map>
#include<queue>
#include<stack>
#include<vector>
#include<math.h>
#include<cstdio>
#include<sstream>
#include<numeric>//STL数值算法头文件
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<functional>//模板类头文件
using namespace std;
const int INF=1e9+7;
const int maxn=11000;
typedef long long ll;
//暴力!!!
//首先,电脑读数的时候竟然是从第一个不是0的开始的!!!
//其次,这一道题用暴力,一天一共1440分钟,所以你把开始时间和结束时间
//化为分钟,然后在区间取x的最大值就是这一的答案
int a[maxn];
int main ()
{
int t,n;
int x,h,m;
scanf("%d",&t);
while (t--)
{
scanf("%d",&n);
memset(a,0,sizeof (a));
for(int i=0; i<n; i++)
{
scanf ("%d", &x);
scanf ("%d:%d", &h, &m);
a[h * 60 + m] += x;
scanf ("%d:%d", &h, &m);
a[h * 60 + m] -= x;
}
int sum = 0;
int maxx = 0;
for (int i = 0; i < maxn; i++)
{
sum += a[i];
if (sum > maxx)
maxx=sum;
}
printf("%d\n",maxx);
}
return 0;
}
TIANKENG’s restaurant HDU - 4883 (暴力)的更多相关文章
- HDU 4883 TIANKENG’s restaurant Bestcoder 2-1(模拟)
TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/O ...
- HDU 4886 TIANKENG’s restaurant(Ⅱ) ( 暴力+hash )
TIANKENG’s restaurant(Ⅱ) Time Limit: 16000/8000 MS (Java/Others) Memory Limit: 130107/65536 K (Ja ...
- hdoj 4883 TIANKENG’s restaurant【贪心区间覆盖】
TIANKENG’s restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/O ...
- HDOJ 4883 TIANKENG’s restaurant
称号: TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Ja ...
- hdu 4883 思维题
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883 TIANKENG’s restaurant Time Limit: 2000/1000 MS (Ja ...
- hdu4886 TIANKENG’s restaurant(Ⅱ) (trie树或者模拟进制)
TIANKENG’s restaurant(Ⅱ) Time Limit: 16000/8000 MS (Java/Others) Memory Limit: 130107/65536 K (Ja ...
- HDU 4883 TIANKENG’s restaurant
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883 解题报告:一家餐馆一天中有n波客人来吃饭,第 i 波 k 客人到达的时间是 s ,离开时的时间 ...
- HDU 4883 TIANKENG’s restaurant (贪心)
链接:pid=4883">带我学习.带我飞 第一次BC,稳挂,WA n多次.今天又一次做了一下 略挫 #include <iostream> #include <cs ...
- HDU 4883 Best Coder Round 2 TIANKENG’s restaurant 解读
有一组数据是在客人到达和出发时间,问:多少把椅子的能力,以满足所有客人的需求,可以有一个地方坐下要求. 有些人甚至开始考虑暴力法,这些数据是少,其实这个问题很多数据, 暴力需求O(n*n)的时间效率, ...
随机推荐
- Jmeter-12-如何使用Plugin Manager
1. 搜索 Jmeter plugin 并找到plugin manager 下载jar文件 2. 放到jmeter/lib/ext下面, 重启jmeter 3. 找到选项-> Plugin ma ...
- JqGrid自定义(图片)列
$("#gridTable").jqGrid({ //...其它属性 colModel: [ //...其它列 { name: , align: "center" ...
- Java常用开发思想与知识点小记(一)
1. 子类在覆盖父类的方法时,不能抛出比父类更多的异常(儿子不能比父亲干更多的坏事),所以只能捕捉异常,通常在web层捕获异常,给用户一个友好提示. 2.Java内存模型与并发编程三个特性 htt ...
- ubuntu tomcat的安装与配置
一.下载jdk 大概是tomat大部分是由java写的, 所以一开始安装tomcat必须得配置好jdk http://www.oracle.com/technetwork/java/javase/do ...
- https 多路复用的理解~转载
https://segmentfault.com/q/1010000005167289 这里面的http/2连接是指tcp/ip层的连接还是http应用层(也就是我们平常在chrome F12 net ...
- ZZ:Solaris 10 软件包分析
ZZ:Solaris 10 软件包分析 http://blog.chinaunix.net/uid-22759617-id-276756.html # Last updated: 2006-02-14 ...
- ASPxCheckBoxList控件获取selected项的text和value的方法
设ASPxCheckBoxList的ClientInstanceName为list_ var needtext; for (var i = 0; i < list_.GetSelectedIte ...
- 修改mysql权限
关于mysql的用户管理,笔记 1.创建新用户 通过root用户登录之后创建 >> grant all privileges on *.* to testuser@localhost id ...
- artDialog的一些例子与一些属性的介绍。
1.支持自定义按钮 var dialog = art.dialog({ title: '警告', content: '点击管理按钮将让删除按钮可用', width: '20em', button: [ ...
- iframe弹出框js ie6下存在bug
ie6的iframe在第一次加载的显示不出来,显示空白,但是很奇怪,刷新就可以正常显示了,一开始以为这只是IE6下iframe加载的bug,但是最后结果发现这是ie6下javascript延迟加载出现 ...