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的更多相关文章
随机推荐
- go实例之排序
1.默认排序 使用sort包进行排序.排序是就地排序,因此它会更改给定的切片,并且不返回新的切片. package main import "fmt" import "s ...
- sed 命令替换字符串
sed -i 's/13/15/g' `grep 13 -rl 目录` -i 表示替换 -r 表示搜索子目录 -l 显示替换名
- ArcGIS API for JavaScript 4.2学习笔记[31] (补充学习)Task类
Task这个东西很有用,是AJS中用于解决各种乱七八糟任务的一个类.它有很多子类,有用于空间分析的,有用于空间查询的,等等. 这篇作为补充学习的第一篇,也是进阶学习的第一篇,我就改个写法. 我将使用思 ...
- 原创js自动补全---auotocomplete
if ($("input.autocomplete_input").length > 0) { $("input.autocomplete_input") ...
- lesson - 5 Linux用户和组管理
1. /etc/passwd由 : 分隔成7个字段(1) 用户名 规则:大小写字母.数字.减号(不能出现在首位).点以及下划线,其他字符不合法 (2) x 放密码,安全起见放到 /etc/shadow ...
- solr安装配置
1.solr是基于tomcat安装部署的 2.网上下载solr-5.2.1 http://lucene.apache.org/solr/downloads.html 3.解压solr文件 tar zx ...
- Windows 刷新DNS缓存
释放IP配置信息 ipconfig /release 刷新DNS ipconfig /flushdns 更新网卡适配器 ipconfig /renew
- java.util.HashSet
Operations Time Complexity Notes add, remove, contains, size O(1) assuming the hash functions has di ...
- windows 下的python 安装pycrypto
一般在官方网站下载pycrypto: https://www.dlitz.net/software/pycrypto/ 然后使用命令就可以安装成功了: python setup.py build ...
- Django中Q查询及Q()对象
问题 一般我们在Django程序中查询数据库操作都是在QuerySet里进行进行,例如下面代码: >>> q1 = Entry.objects.filter(headline__st ...