BestCoder Round #2 1001 TIANKENG’s restaurant
不得不说,bastcoder是个hack游戏啊。!。
题意:求最少要多少张椅子才干让全部来的客人有地方坐!!
就是一个区间的处理吧!!!和HDU 1556 我待水似流年。流年待我似水神似!
。。!
求的是重叠的区间最大,我们仅仅要标记每一个区间会有多少人就能够了!
!
!
然后在从0到1440分统计就OK了。!
AC代码例如以下:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<map>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std; struct h
{
int r,h1,m1,h2,m2;
}a[10005]; int main()
{
int t;
cin>>t;
int i,j;
int b[2000];
while(t--)
{
memset(b,0,sizeof b);
int n;
cin>>n;
for(i=0;i<n;i++)
{
scanf("%d %d:%d %d:%d",&a[i].r,&a[i].h1,&a[i].m1,&a[i].h2,&a[i].m2);
a[i].m1=a[i].m1+60*a[i].h1;a[i].m2=a[i].m2+60*a[i].h2;
b[a[i].m1]+=a[i].r;b[a[i].m2]-=a[i].r;
}
int maxx;
maxx=0;
int ans=0;
for(i=0;i<=1440;i++)
{
ans+=b[i];
if(ans>maxx)
maxx=ans;
}
cout<<maxx<<endl;
}
return 0;
}
BestCoder Round #2 1001 TIANKENG’s restaurant的更多相关文章
- 贪心 BestCoder Round #39 1001 Delete
题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ # ...
- 暴力 BestCoder Round #41 1001 ZCC loves straight flush
题目传送门 /* m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换 ╰· */ #include <cstdio> #include < ...
- 暴力 BestCoder Round #46 1001 YJC tricks time
题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一 ...
- 字符串处理 BestCoder Round #43 1001 pog loves szh I
题目传送门 /* 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 */ #include <cstdio> #incl ...
- BestCoder Round #75 1001 - King's Cake
Problem Description It is the king's birthday before the military parade . The ministers prepared a ...
- BestCoder Round #92 1001 Skip the Class —— 字典树 or map容器
题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关 ...
- BestCoder Round #61 1001 Numbers
Problem Description There are n numbers A1,A2....An{A}_{1},{A}_{2}....{A}_{n}A1,A2....An,yo ...
- BestCoder Round #87 1001
GCD is Funny Accepts: 524 Submissions: 1147 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 655 ...
- BestCoder Round #60 1001
Problem Description You are given a sequence of NNN integers. You should choose some numbers(at leas ...
随机推荐
- C++11程序设计要点总结-模板机制详解
C++程序设计要点总结 在编程的过程中呢我们总会遇到一些各种各样的问题,就比如在写方法的时候,我们一个同样的方法要写好几种类型的呢,这让我们很伤脑筋,但是呢C++有一个强大的功能就是模板机制,这个模板 ...
- kvm的4中网络模型(qemu-kvm)
1. 隔离模式(类似vmare中仅主机模式):虚拟机之间组建网络,该模式无法与宿主机通信,无法与其他网络通信,相当于虚拟机只是连接到一台交换机上,所有的虚拟机能够相互通信. 2. 路由模式:相当于虚拟 ...
- Verdi:内存不足
如果进行Verdi compile时,出现memory资源不够用.有可能case中出现了问题(或许发生了死循环,造成内存严重占用),此时尽量瘦身TC_FILE_LIST文件,缩小问题case的范围.
- Mac 配置 php-fpm
Mac 自带 php-fpm,在终端执行 php-fpm,会报如下错误: ERROR: failed to open configuration file '/private/etc/php-fpm. ...
- PHP 配置文件php.ini文件优化
PHP 5.3.3 safe_mode = On #控制php中的函数执行比如system() 这个函数可以调用系统目录 比如 rm ,打开这个配置之后,同时把很多文件操作的函数进行了权限控制 saf ...
- MyISAM和InnoDB索引实现对比
MyISAM索引实现 MyISAM引擎使用B+Tree作为索引结构,叶节点的data域存放的是数据记录的地址.如图: 这里设表一共有三列,假设我们以Col1为主键,则上图是一个MyISAM表的主索引 ...
- Apache手册
一.apache的安装 如果不指定安装位置,默认为/usr/local/apache2/
- 29个非常流行的jQuery提示信息插件
在网站的设计中,提示信息是非常细微的功能,但是起着非常重要的作用.如果你的网站中提示信息做的比较好,会给浏览者留下非常深刻的印象,同时也会起到非常好的网站宣传效果,下面介绍了30个比较流行提示信息插件 ...
- 大数据学习——Linux-SSH报错:Could not resolve hostname centos02: Temporary failure in name resolution
https://blog.csdn.net/mcb520wf/article/details/83303792 随笔异常 ssh: Could not resolve hostname centos0 ...
- IDEA maven 无法加载已经安装的模块依赖包
今天打包一直报如下错误 Reactor Summary for freechain-op 1.0.1.OP: [INFO] [INFO] freechain-op .................. ...