不得不说,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. Spring boot 项目打成war包并在idea中运行

    1. 修改pom文件原来是jar改成<packaging>war</packaging> 2. 在pom文件中添加移除内置tomcat并且添加添加servlet-api的依赖. ...

  2. saltstack入门个人笔记

    offical website reference1 reference2 install apt-get install python-software-properties apt install ...

  3. Angular缺少 FormsModule

    虽然 ngModel是一个有效的 Angular 指令,不过它在默认情况下是不可用的. 解决方法: 在根模块引入FormModule import { FormsModule } from '@ang ...

  4. 下划线hover下动态出现技巧

    酷炫的动画效果往往更能吸引眼球,下面我将分享纯CSS中,hover的时候出现下划线动态飞入的技巧. 1.下划线从左侧飞入: div::before{ content:""; wid ...

  5. 服务器编程心得(四)—— 如何将socket设置为非阻塞模式

    1. windows平台上无论利用socket()函数还是WSASocket()函数创建的socket都是阻塞模式的: SOCKET WSAAPI socket( _In_ int af, _In_ ...

  6. Gameia

    F - Gameia HDU - 6105   Alice and Bob are playing a game called 'Gameia ? Gameia !'. The game goes l ...

  7. python基础(一)—— 核心数据类型

    Hello World程序 [root@mysql ~]# python3 Python 3.6.5 (default, Jul  8 2018, 11:41:23) [GCC 4.4.7 20120 ...

  8. luogu2485 [SDOI2011]计算器 poj3243 Clever Y BSGS算法

    BSGS 算法,即 Baby Step,Giant Step 算法.拔山盖世算法. 计算 \(a^x \equiv b \pmod p\). \(p\)为质数时 特判掉 \(a,p\) 不互质的情况. ...

  9. @locked_cached_property ---flask.helpers模块

    源码: class locked_cached_property(object): """A decorator that converts a function int ...

  10. POJ2455 Secret Milking Machine【二分,最大流】

    题目大意:N个点P条边,令存在T条从1到N的路径,求路径上的边权的最大值最小为多少 思路:做了好多二分+最大流的题了,思路很好出 二分出最大边权后建图,跑dinic 问题是....这题是卡常数的好题! ...