BestCoder Round #2 1001 (简单处理)
题意:给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 (简单处理)的更多相关文章
- 贪心 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 #87 1001
GCD is Funny Accepts: 524 Submissions: 1147 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 655 ...
- HDU 5776 sum (BestCoder Round #85 A) 简单前缀判断+水题
分析:就是判断简单的前缀有没有相同,注意下自身是m的倍数,以及vis[0]=true; #include <cstdio> #include <cstdlib> #includ ...
- BestCoder Round #61 1001 Numbers
Problem Description There are n numbers A1,A2....An{A}_{1},{A}_{2}....{A}_{n}A1,A2....An,yo ...
随机推荐
- 特征值分解,奇异值分解(SVD)
特征值分解和奇异值分解在机器学习领域都是属于满地可见的方法.两者有着很紧密的关系,我在接下来会谈到,特征值分解和奇异值分解的目的都是一样,就是提取出一个矩阵最重要的特征. 1. 特征值: 如果说一个向 ...
- SharePoint 优化显示WebParts
在开发sharepoint中,经常遇到需要自定义显示列表中的一部分作为导航的内容, 如公告栏,新闻链接,最新动态等.... 我们通常需要显示一个列表的标题,并且限制字符长度, 外加一些条件,如按创建的 ...
- 在VisualStudio 2012上使用MVC3出现错误的解决办法
1. 错误: 找不到方法:“System.Collections.Generic.Dictionary`2<System.String,BlockParser> System.Web.Ra ...
- openmeetings 视频会议系统介绍
在功能上,视频会议具有如下特点(这一部分转自:http://www.kissthink.com/archive/5150.html): 1.该方基于P2P技术,服务器压力小.流畅.用户之间可以互相获取 ...
- Flex 教程(1)-------------控件拖动
今天和大家分享下关于在Flex中 针对控件的拖动开发. 1.需要在 .mxml文件中编写一个Button按钮 如下代码: <s:Button id="button1" lab ...
- Oracle 临时事务表 全局临时表_global temporary table
所有的操作都在一个事务里,事务提交后,此表清空,特别适合做插入删除频率特别高的临时表操作,比如插入完数据就开始查询,查询完就删掉等,用完就扔! 临时表分事务级临时表和会话级临时表. 事务级临时表只对当 ...
- EBP与ESP寄存器的使用
push ebp mov esp,ebp esp是堆栈指针 ebp是基址指针 这两条指令的意思是将栈顶指向ebp的地址 ---------------------------------------- ...
- 【WCF--初入江湖】13 实战
13 实战 在线升级 using System; using System.Collections.Generic; using System.ComponentModel; using System ...
- jquery div层级选择器
div id="modelName" class="modelName"> <!-- 车系的层 --> <div name=" ...
- POJ 1716
#include <iostream> #include <algorithm> #define MAXN 20005 using namespace std; int _m[ ...