题目链接

题意:给N条信息,每个信息代表有x个人从开始的时间 到 结束的时间在餐厅就餐,

问最少需要多少座位才能满足需要。

分析:由于时间只有24*60 所以把每个时间点放到 数组a中,并标记开始的时间+x,

结束的时间 -x。最后累加比较。

如果时间点太多的时候可以把时间点放到结构体里,排序,然后依次枚举结构体。

 #include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>
#define LL long long
#define rep(i, a, b)for(int i = a; i < b; i++)
const int maxn = +; using namespace std;
int a[maxn]; int main()
{
int t, n, x, h, m, ans;
cin>>t;
while(t--)
{
memset(a, , sizeof(a));
cin>>n;
while(n--)
{
scanf("%d %d:%d", &x, &h, &m);
a[h*+m] += x;
scanf("%d:%d", &h, &m);
a[h*+m] -= x;
}
ans = ;
rep(i, , maxn-)
a[i] += a[i-];
rep(i, , maxn-)
if(a[i]>ans)
ans = a[i];
cout<<ans<<endl;
}
}

BestCoder Round #2 1001 (简单处理)的更多相关文章

  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 #87 1001

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

  8. HDU 5776 sum (BestCoder Round #85 A) 简单前缀判断+水题

    分析:就是判断简单的前缀有没有相同,注意下自身是m的倍数,以及vis[0]=true; #include <cstdio> #include <cstdlib> #includ ...

  9. 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 ...

随机推荐

  1. C++中的运算符优先级

    1   ()  []  .  ->2   !  ~   -(负号) ++  --   &(取变量地址)*   (type)(强制类型)    sizeof 3   * / % 4   + ...

  2. 【转】java获取当前路径的几种方法

    1.利用System.getProperty()函数获取当前路径: System.out.println(System.getProperty("user.dir"));//use ...

  3. C# 数组CopyTo

    private void button1_Click(object sender, RoutedEventArgs e) { int[] copy1 = { 1, 2, 3, 4 }; int[] c ...

  4. WPF解析PDF为图片

    偶遇需要解析PDF文件为单张图,此做, http://git.oschina.net/jiailiuyan/OfficeDecoder using System; using System.Colle ...

  5. Qt入门之信号与槽机制

    一. 简介 就我个人来理解,信号槽机制与Windows下消息机制类似,消息机制是基于回调函数,Qt中用信号与槽来代替函数指针,使程序更安全简洁. 信号和槽机制是 Qt 的核心机制,可以让编程人员将互不 ...

  6. Document.defaultView

    Document.defaultView 引子 最近愚安在写一个可以将页面上的资源链接转为二维码以方便移动端浏览的chrome插件,由于dom操作并不多,而且作为插件不需要考虑跨 浏览器兼容性,所以并 ...

  7. python爬取某些网站出错的解决办法

    用urllib2.urlopen方法打开糗事百科的网站,http://www.qiushibaike.com/,发现会失败,网上百度,说可能是服务器端对爬虫做了屏蔽,需要伪装header头部信息,下面 ...

  8. C++同步串口通信

    问题描述:     C++串口通信,设置同步串口通信 问题解决:     (1)打开串口 注:     使用串口需要添加<Windows.h>头文件,打开串口主要是使用CreateFile ...

  9. MemSQL Start[c]UP 2.0 - Round 1

    A. Eevee http://codeforces.com/contest/452/problem/A 字符串水题 #include<cstdio> #include<cstrin ...

  10. Tesseract-OCR牛刀小试:模拟请求时的验证码识别

    原文:http://yaohuiji.com/tag/tesseract%EF%BC%8Cocr%EF%BC%8C%E9%AA%8C%E8%AF%81%E7%A0%81/ 有个邪恶的需求,需要识别验证 ...