TIANKENG’s restaurant--hdu4883
TIANKENG’s restaurant
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 1629 Accepted Submission(s): 588
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
6 08:00 09:00
5 08:59 09:59
2
6 08:00 09:00
5 09:00 10:00
这个题主要思想时,找出重叠时间区间的最大人数!!简单代码,贪心思想
#include<stdio.h>
#include<string.h>
int main()
{
int n,i,N,j,time[],a,b,c,d,e;
scanf("%d",&N);
while(N--)
{
int bb,ee,max;
memset(time,,sizeof(time));
scanf("%d",&n);
max=;
for(i=;i<n;i++)
{
scanf("%d%d:%d%d:%d",&a,&b,&c,&d,&e);
bb=b*+c;
ee=d*+e;
for(j=bb;j<ee;j++)
time[j]+=a;//重叠区域相加人数
}
for(i=;i<*;i++)
max=max>time[i]?max:time[i];
printf("%d\n",max);
}
return ;
}
TIANKENG’s restaurant--hdu4883的更多相关文章
- 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 TIANKENG’s restaurant Bestcoder 2-1(模拟)
TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/O ...
- hdu4886 TIANKENG’s restaurant(Ⅱ) (trie树或者模拟进制)
TIANKENG’s restaurant(Ⅱ) Time Limit: 16000/8000 MS (Java/Others) Memory Limit: 130107/65536 K (Ja ...
- HDU 4886 TIANKENG’s restaurant(Ⅱ) ( 暴力+hash )
TIANKENG’s restaurant(Ⅱ) Time Limit: 16000/8000 MS (Java/Others) Memory Limit: 130107/65536 K (Ja ...
- TIANKENG’s restaurant HDU - 4883 (暴力)
TIANKENG manages a restaurant after graduating from ZCMU, and tens of thousands of customers come to ...
- 杭电 4883 TIANKENG’s restaurant (求饭店最少需要座椅)
Description TIANKENG manages a restaurant after graduating from ZCMU, and tens of thousands of custo ...
- HDU 4883 TIANKENG’s restaurant
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883 解题报告:一家餐馆一天中有n波客人来吃饭,第 i 波 k 客人到达的时间是 s ,离开时的时间 ...
- TIANKENG’s restaurant
Problem B:http://codeforces.com/contest/616/problem/B B. Dinner with Emma 题意:一对夫妻要去餐厅吃晚饭,Emma 想去最豪华( ...
- HDU 4883 TIANKENG’s restaurant (贪心)
链接:pid=4883">带我学习.带我飞 第一次BC,稳挂,WA n多次.今天又一次做了一下 略挫 #include <iostream> #include <cs ...
随机推荐
- php 数组Array 删除指定键名值
if(array_key_exists('keyname',$array)){ //检查数组中此键名是否存在: unset($array['keyname']); //删除后位置仍然保留,但清空了键名 ...
- TENX_ASM.uew
/L14"TENX ASM" Nocase Line Comment = ; File Extensions = INC ASM LST H /Colors = ,,,,, /Co ...
- javascript 之 location.href、跨窗口调用函数
location.href这个东西常常用于跳转,location既是window对象的属性,又是document对象的属性. JavaScript hash 属性 -- 返回URL中#符号后面的内容 ...
- SQL Server 索引的图形界面操作 <第十二篇>
一.索引的图形界面操作 SQL Server非常强大的就是图形界面操作.关于索引方面也一样那么强大,很多操作比如说重建索引啊,查看各种统计信息啊,都能够通过图形界面快速查看和操作,下面来看看SQL S ...
- Android studio修改debug.keystore
在android studio项目中配置自定义的debug keystore 方法/步骤 在项目的build.gradle中添加如下内容: android { signingConfigs ...
- 转:DataTable的一些特殊用法:Select
当你从数据库里取出一些数据,然后要对数据进行整合,你很容易就会想到: 1DataTable dt = new DataTable();//假设dt是由"SELECT C1,C2,C3 FRO ...
- C++静态成员函数不能调用非静态成员变量
其实我们从直观上可以很好的理解静态成员函数不能调用非静态成员变量这句话因为无论是静态成员函数还是静态成员变量,它们 都是在类的范畴之类的,及在类的整个生存周期里始终只能存在一份.然而非静态成员变量和非 ...
- windows套接字相关函数
windows套接字相关函数 作者:vpoet mail:vpoet_sir@163.com 我们学习TCP/IP协议无非是利用这些协议进行通信开发,然而如果让我们自己来直接根据协议规则和协议格式来进 ...
- html5 laboratory - drawing in the canvas
html5 laboratory - drawing in the canvas Creating a bar chart with canvas 21st February 2010 The exp ...
- OpenRisc-45-or1200的ID模块分析
引言 之前,我们分析了or1200流水线的整体结构,也分析了流水线中IF级,EX级,本小节我们来分析ID(insn decode)级的一些细节. 1,基础 or1200的pipeline的ID阶段包含 ...