TIANKENG’s restaurant

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)

Total Submission(s): 1760    Accepted Submission(s): 635

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
//求区间最大相交的问题、暴力解法
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <stack>
#include <cstdlib>
using namespace std; int main() {
int t ;
cin >> t;
while (t --) {
int n;
scanf("%d",&n);
int s1, s2, s3, s4;
int c[1500];
memset(c, 0, sizeof(c));
int num ;
while (n --) {
scanf("%d",&num);
scanf("%d:%d %d:%d",&s1,&s2,&s3,&s4);
int be = s1*60 + s2;
int en = s3*60 + s4;
for (int i = be; i<en; i++)
c[i] += num;
}
int max = 0;
for (int i = 1; i<=1440; i++) {
if (c[i] > max)
max = c[i];
}
printf("%d\n",max);
} return 0 ;
}

HDU_4883的更多相关文章

随机推荐

  1. apache故障处理

    注意:修改虚拟机主机html路径不需要修改主配置这一行. DocumentRoot "/var/www" 1.Permission denied: [client 10.10.2. ...

  2. MySQL数据库规约.

    一.建表规约 1.表达是与否概念的字段,必须使用 is_xxx 的方式命名,数据类型是 unsigned tinyint(1 表示是, 0 表示否) . 2.表名.字段名必须使用小写字母或数字, 禁止 ...

  3. 653. Two Sum IV - Input is a BST

    Given a Binary Search Tree and a target number, return true if there exist two elements in the BST s ...

  4. STM32基础分析——USART的DMA模式

    有关USART的DMA传输模式,其基本的概念和配置,网上有很多博客和教程都有,这里不再赘述,只是记录一下比较容易忽视而造成调试不通的问题. 1. 串口发送和接收分属两个DMA通道 一般方式操作串口时, ...

  5. Windows Server服务器日常管理技巧

    高效管理服务器一直离不开有效的服务器管理技巧,尽管你已经掌握了不少这方面的技巧,但服务器还有许许多多的技巧在等着你的总结,等着你的挖掘;这不,下面的一些服务器管理窍门就是笔者在最近的工作中总结出来的, ...

  6. RabbitMQ教程(一) ——win7下安装RabbitMQ

    RabbitMQ依赖erlang,所以先安装erlang,然后再安装RabbitMQ; 下载RabbitMQ,下载地址: rabbitmq-server-3.5.6.exe和erlang,下载地址:o ...

  7. HTTPS加密流程超详解(二)

    2.进入正题 上篇文章介绍了如何简单搭建一个环境帮助我们分析,今天我们就进入正题,开始在这个环境下分析. 我们使用IE浏览器访问Web服务器根目录的test.txt文件并抓包,可以抓到如下6个包(前面 ...

  8. java递归实现文件夹文件的遍历输出

    学习java后对一个面试小题(今年年初在团结湖面试的一个题目) 的习题的编写. ''给你一个文件,判断这个文件是否是目录,是目录则输入当前目录文件的个数和路径,''' /** * @author li ...

  9. oracle自动备份_expdp_Linux

    [oracle@hbsjxtdb1 ~]$ crontab -e 0 4 * * * /backup/script/backupexpdp.sh [oracle@hbsjxtdb1 ~]$ cront ...

  10. 搭建redis cluster

    1  下载 redis安装包 tar zxvf redis-3.0.2.tar.gz cd redis-3.0.2/ make make install 2安装ruby sudo apt-get in ...