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 ...
随机推荐
- 安装Windows10+Ubentu18双系统
1.先安装Windows系统,安装完成后,使用磁盘管理工具划分出一定的freespace空间留给linux安装系统用. 2.使用Universal-USB-Installer制作ubentu启动U盘. ...
- C#对象初始化的探讨
最近在弄MQ的性能监测数据埋点,无疑中用到一个Nstatsd的客户端,看到里面写过里面一种嵌套类的写法.代码如下: 客户端Client是一个密封的类,并且构造函数私有访问.然后又用一个嵌套类Curre ...
- python基础002
1.pycharm安装与添加解释器 专业版.英文界面,不要汉化—一定要尊重知识产权 算术运算符:+ - * / // % ** ^ 布尔运算符:== > < >= <= 逻辑运 ...
- Highlights in a Journal
** Highlights **** example- b huang, 2016, Design and performance enhancement of a bi-directional co ...
- 给Django中的url起名字
url反转 =>reverse 1.from django.shortcuts import reverse 2. 利用reverse函数对URL名称进行反转 reverse(url名称 ...
- 阿里云配置tomcat后不能访问问题
问题:使用阿里云centos 7.2配置好tomcat后,启动时间9分多钟,停在webapps下的manage这里近9分多钟 解决:进入 /usr/local/jdk1.8.0_144/jre/lib ...
- JVM——内存管理和垃圾回收
1. 何为GC 转载请注明出处:http://blog.csdn.net/seu_calvin/article/details/51892567 Java与C语言相比的一个优势是,可以通过自己的JV ...
- ES6(Iterator 和 for...of 循环)
Iterator 和 for...of 循环 1.什么是 Iterator 接口 Iterator 接口功能:用一种相同办法的接口让不同的数据结构得到统一的读取命令的方式 2.Iterator的基本用 ...
- JavaScript验证密码强度
JavaScript的方法: <script type="text/javascript"> window.onload = function () { documen ...
- BestCoder Round #90 A+B题解!
BestCoder Round #90 A Kblack loves flag 题意有点迷不造思路很简单但不造怎么求随机数,纠结了一会后直接粘上题目所给的代码稍加修改A了. const int _K ...