UVALive 6606 Meeting Room Arrangement 【搜索】
来源:互联网 发布:淘宝客返利网 赚钱 编辑:程序博客网 时间:2024/06/07 06:23
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4617
题目大意:现在有一个房间,租用的时间是1~12点,已知一些会议的开始时间和结束时间,问最多可以开多少会议(会议时间不可以冲突)。
对结束时间进行一个排序,然后查找即可。
#include<iostream>#include<algorithm>#include<stdio.h>using namespace std;#define maxn 105struct node { int s, e;};bool cmp(node x, node y){ return x.e<y.e;}int main (){ int T; scanf("%d",&T); node time[maxn]; while(T--) { int pos=0,ans=0; while(1){ scanf("%d%d",&time[pos].s,&time[pos].e); if(time[pos].s==0&&time[pos].e==0) break; pos++; } sort(time,time+pos,cmp); int ee = 0; for(int i=0;i<pos;i++){ if(time[i].s>=ee){ ans++; ee = time[i].e; } } printf("%d\n",ans); }}
0 0
- UVALive 6606 Meeting Room Arrangement 【搜索】
- Meeting Room Arrangement
- UVA Meeting Room Arrangement
- hnu 13003 Meeting Room Arrangement
- Meeting Room Arrangement(贪心)
- meeting room III
- UVALive_6606_Meeting Room Arrangement(最大独立集)
- 南邮 OJ 1462 Meeting Schedule Arrangement
- Beautiful Arrangement--深度搜索--leetcode
- Sleeping on the floor of a meeting room...
- 【Leetcode】252,253 meeting room系列 区间问题
- Facebook面试题 meeting rooms 求同时最多meeting room的时间
- UVALive 6117 (LA 6117) Pole Arrangement 动态规划
- UVALive 6093 Emergency Room --优先队列实现的模拟
- Arrangement
- UVALive 4877 记忆搜索
- Room
- How to book meeting room and setup vacation/OOF in Outlook Calendar
- android--内存泄漏的原因及相关分析
- Cassandra 的数据存储结构
- Ruby 判断字符串是否对称
- 我母亲是个非常节俭的人
- SSH框架(一) Web开发中获取Spring的ApplicationContext的三种方式
- UVALive 6606 Meeting Room Arrangement 【搜索】
- 编程之美之二分查找总结
- 最大连续子序列
- HDU4968:Improving the GPA(DP)
- 内部类
- WebService客户端调用
- OOP的AOP的关系
- EditText插入图片,
- nyoj 105 九的余数