不得不说,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的更多相关文章

  1. 贪心 BestCoder Round #39 1001 Delete

    题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ # ...

  2. 暴力 BestCoder Round #41 1001 ZCC loves straight flush

    题目传送门 /* m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换 ╰· */ #include <cstdio> #include < ...

  3. 暴力 BestCoder Round #46 1001 YJC tricks time

    题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一 ...

  4. 字符串处理 BestCoder Round #43 1001 pog loves szh I

    题目传送门 /* 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 */ #include <cstdio> #incl ...

  5. BestCoder Round #75 1001 - King's Cake

    Problem Description It is the king's birthday before the military parade . The ministers prepared a ...

  6. BestCoder Round #92 1001 Skip the Class —— 字典树 or map容器

    题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关 ...

  7. BestCoder Round #61 1001 Numbers

    Problem Description There are n numbers A1,A2....An{A}_{1},{A}_{2}....{A}_{n}A​1​​,A​2​​....A​n​​,yo ...

  8. BestCoder Round #87 1001

    GCD is Funny Accepts: 524 Submissions: 1147 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 655 ...

  9. BestCoder Round #60 1001

    Problem Description You are given a sequence of NNN integers. You should choose some numbers(at leas ...

随机推荐

  1. 关于DTCC数据库技术大会

    本次DTCC数据库技术大会是第9届了,这次大会虽然有不少公司的产品推介,总体来说还是有不少干货的. 专场较多,有选择地主要听了大数据实践跟流式计算这块.网易跟滴滴的分享比较不错. 了解到了现在大家是用 ...

  2. Global Round 2

    A - Ilya and a Colorful Walk CodeForces - 1119A Ilya lives in a beautiful city of Chordalsk. There a ...

  3. bzoj3272 Zgg吃东西

    题目描述: bz 题解: 线段树模拟费用流. 想法和种树有点类似. 每次取区间内权值和最大的一段,然后整体乘$-1$,代表再次选中时会去掉之前的影响. 线段树维护一堆东西…… 小白逛公园双倍快乐.乘$ ...

  4. springmvc请求小例子

    1.welcome.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" ...

  5. 前端面试绝对会考的JS问题!【已经开源】

    写在前面 [前端指南]前端面试库已经开源,正在完善之中 [x] css问题 [x] html问题 [x] javascript问题 github地址 https://github.com/nanhup ...

  6. hdu4407Sum(容斥原理)

    http://acm.hdu.edu.cn/showproblem.php?pid=4407 Sum Time Limit: 2000/1000 MS (Java/Others)     Memory ...

  7. soc desgin 目前需要做的事情

    1.熟练的画时序图 达到一旦有想法可以立即通过时序图表达出来. 2.下面是项目中经常用到的典型设计 2.1串并互相转换 2.2cdc 2.3握手协议 2.4cgc(门控时钟) 2.5AHB2reg文件 ...

  8. Python之微信-微信好友头像合成

    仔细看下图,你的头像就藏在里面哦!!! 有没有犯密集恐惧症?这并不震撼,如果你有 5000 位好友的话,做出来的图看着会更刺激些. 看完了图,你可能想知道这个图咋做出来的,不会是我闲着无聊把把好友头像 ...

  9. Leetcode 321.拼接最大数

    拼接最大数 给定长度分别为 m 和 n 的两个数组,其元素由 0-9 构成,表示两个自然数各位上的数字.现在从这两个数组中选出 k (k <= m + n) 个数字拼接成一个新的数,要求从同一个 ...

  10. html template & import link bug

    html template & import link bug html templates is OK https://caniuse.com/#search=html%20template ...