链接: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): 566    Accepted Submission(s): 267

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
 
Source

---------------------------------------------------------------------

 #include <stdio.h>
#include <stdlib.h>
#include <string.h> int main()
{
int str[];
int n,m,i,j,k,t,num,hh1,hh2,mm1,mm2;
scanf("%d",&n);
while(n--)
{
memset(str,,sizeof(str));
scanf("%d",&m);
for(i=;i<m;i++)
{
scanf("%d %d:%d %d:%d",&num,&hh1,&mm1,&hh2,&mm2);
hh1=hh1*+mm1;
hh2=hh2*+mm2;
str[hh1]+=num;
str[hh2]-=num;//printf("%d%d^^",str[hh1],str[hh2]);
}
int maxx=,cas=;
for(i=;i<=;i++)
{
cas+=str[i];
if(cas>maxx)
{
maxx=cas;
}
}
printf("%d\n",maxx);
}
return ;
}

hdu 4883 思维题的更多相关文章

  1. hdu 5014 思维题/推理

    http://acm.hdu.edu.cn/showproblem.php?pid=5014 从小数開始模拟找方法规律,然后推广,尤其敢猜敢尝试,错了一种思路继续猜-----这是一种非常重要的方法啊 ...

  2. Just Random HDU - 4790 思维题(打表找规律)分段求解

    Coach Pang and Uncle Yang both love numbers. Every morning they play a game with number together. In ...

  3. HDU 6464 权值线段树 && HDU 6468 思维题

    免费送气球 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submi ...

  4. 朋友HDU - 5963 (思维题) 三种方法

    传送门 题目描述 输入 输出 样例输入 Sample Input 样例输出 Boys win! Girls win! Girls win! Boys win! Girls win! Boys win! ...

  5. Fang Fang HDU - 5455 (思维题)

    Fang Fang says she wants to be remembered. I promise her. We define the sequence FF of strings. F0 = ...

  6. HDU 1029 Ignatius and the Princess IV / HYSBZ(BZOJ) 2456 mode(思维题,~~排序?~~)

    HDU 1029 Ignatius and the Princess IV (思维题,排序?) Description "OK, you are not too bad, em... But ...

  7. HDU 6298.Maximum Multiple-数学思维题(脑子是个好东西,可惜我没有) (2018 Multi-University Training Contest 1 1001)

    暑假杭电多校第一场,这一场是贪心场,很多贪心的题目,但是自己太菜,姿势挫死了,把自己都写吐了... 2018 Multi-University Training Contest 1 HDU6298.M ...

  8. hdu5325 树的思维题

    pid=5325">http://acm.hdu.edu.cn/showproblem.php? pid=5325 Problem Description Bobo has a tre ...

  9. zoj 3778 Talented Chef(思维题)

    题目 题意:一个人可以在一分钟同时进行m道菜的一个步骤,共有n道菜,每道菜各有xi个步骤,求做完的最短时间. 思路:一道很水的思维题, 根本不需要去 考虑模拟过程 以及先做那道菜(比赛的时候就是这么考 ...

随机推荐

  1. Qunar实习回顾总结

    今天教师节,陪老师喝点小酒,回来难得抽空,整理一下实习阶段的那些零零碎碎却很有用的知识. 1.关于页面中嵌入js代码 (1)有时为了精确控制代码执行顺序流,会将js代码嵌入到网页之中.优点:改变代码触 ...

  2. scala一些高级类型

    package com.ming.test import scala.collection.mutable.ArrayBuffer import scala.io.Source import java ...

  3. 专为物联网开发的开源操作系统Contiki(转)

    专为物联网开发的开源操作系统Contiki(转)  (2012-04-19 15:31:09) 原文网址:http://blog.sina.com.cn/s/blog_6de000c201010z7n ...

  4. Hibernate,Session方法使得java对象进入持久化状态;持久化对象特征

    以下情况java对象进入持久化状态: session.save()方法把临时对象转变为持久化对象. session.load()和session.get()方法得到的对象总是处于持久化状态. sess ...

  5. Docker CPU 资源限制——CPU固定核功能测试

    Docker使用Linux cgroup来实现资源的限制,对于CPU的限制有两种方法: 1.cpuset CPU Set限定容器使用某个固定的CPU核.使用默认的libcontainer引擎时,可以通 ...

  6. MySQL存储引擎中的MyISAM和InnoDB区别详解

    在使用MySQL的过程中对MyISAM和InnoDB这两个概念存在了些疑问,到底两者引擎有何分别一直是存在我心中的疑问.为了解开这个谜题,搜寻了网络,找到了如下信息: MyISAM是MySQL的默认数 ...

  7. PHP最原始的上传文件函数

    <?php $upload_file=$_FILES['upload_file']['tmp_name']; $upload_file_name=$_FILES['upload_file'][' ...

  8. 做一个MVC4的项目时留下的经验--增加IPrange

    /* CR#1796870 modify by v-yangwu, add a js file to control the page controls. */ $(document).ready(f ...

  9. python 购物车和三级菜单

    程序:购物车程序 需求: 启动程序后,让用户输入工资,然后打印商品列表 允许用户根据商品编号购买商品 用户选择商品后,检测余额是否够,够就直接扣款,不够就提醒 可随时退出,退出时,打印已购买商品和余额 ...

  10. 每日一九度之题目1016:火星A+B

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5346 解决:1464 题目描述:     读入两个不超过25位的火星正整数A和B,计算A+B.需要注意的是:在火星上,整数不是单一进制的, ...