HDU_4883
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
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?
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.
2
2
6 08:00 09:00
5 08:59 09:59
2
6 08:00 09:00
5 09:00 10:00
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的更多相关文章
随机推荐
- [array] leetcode - 31. Next Permutation - Medium
leetcode - 31. Next Permutation - Medium descrition Implement next permutation, which rearranges num ...
- scala写算法-用小根堆解决topK
topK问题是指从大量数据中获取最大(或最小)的k个数,比如从全校学生中寻找成绩最高的500名学生等等. 本问题可采用小根堆解决.思路是先把源数据中的前k个数放入堆中,然后构建堆,使其保持堆序(可以简 ...
- JS如何实现导航栏的智能浮动
<script language="javascript"> function smartFloat(obj) { var obj = docu ...
- bzoj 3675: [Apio2014]序列分割
Description 小H最近迷上了一个分隔序列的游戏.在这个游戏里,小H需要将一个长度为n的非负整数序列分割成k+1个非空的子序列.为了得到k+1个子序列,小H需要重复k次以下的步骤: 1.小H首 ...
- Locust no-web 模式与参数详解
读前参考:<性能测试工具Locust > 熟悉 Apache ab 工具的同学都知道,它是没有界面的,通过命令行执行. Locust 同样也提供的命令行运行,好处就是更节省客户端资源. 命 ...
- (通用)深度学习环境搭建:tensorflow安装教程及常见错误解决
区别于其他入门教程的"手把手式",本文更强调"因"而非"果".我之所以加上"通用"字样,是因为在你了解了这个开发环境之后 ...
- 高级开发层面,针对Hibernate方面面试题的总结(对其它ORM也适用)
虽然目前mytabis用得比较多,但Hibernate相对比较容易上手,而且也有不少公司在用,所以本文就用这个举例,事实上,本文给出的面试建议也适用于各种ORM.本文摘自java web轻量级开发面试 ...
- Oracle学习笔记_06_CASE WHEN 用法介绍
1. CASE WHEN 表达式有两种形式 --简单Case函数 CASE sex ' THEN '男' ' THEN '女' ELSE '其他' END --Case搜索函数 CASE ' THEN ...
- js知识点图解
- Head First设计模式之中介者模式
一.定义 又称为调停者模式,定义一个中介对象来封装系列对象之间的交互.中介者使各个对象不需要显示地相互引用,从而使其耦合性松散,而且可以独立地改变他们之间的交互. 二.结构 组成: ● 抽象中介者(M ...