Problem E
#include
#include
using namespace std;
struct Ti{
int s;
int e;
bool
operator < (const Ti& other) const
{
if(this->e==other.e)
this->s
return this->e
}
};
int main()
{
//freopen("in.txt", "r", stdin);
int
n,s,e,ans=1,d=1;
Ti
t1[101],t2[101];
while(~scanf("%d",&n)&&n)
{
ans=1;
d=1;
for(int i=0;i
{
scanf("%d%d",&s,&e);
t1[i].s=s;
t1[i].e=e;
}
stable_sort(&t1[0],&t1[n]);//按照节目时间由短到长排列
t2[0]=t1[0];//因为第一个是必须看的;
//cout<<"t1[0].s="<<t1[0].s<<"
"<<"t1[0].e="<<t1[0].e<<endl;
for(int i=1;i
{
if(t1[i].s>=t2[d-1].e)
{
//cout<<"t2[d-1].s="<<t2[d-1].s<<"
"<<"t2[d-1].e="<<t2[d-1].e<<endl;
t2[d++]=t1[i];
ans++;
}
//cout<<"t1[i].s="<<t1[i].s<<"
"<<"t1[i].e="<<t1[i].e<<endl;
}
printf("%d\n",ans);
}
}
Problem E的更多相关文章
- 1199 Problem B: 大小关系
求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...
- No-args constructor for class X does not exist. Register an InstanceCreator with Gson for this type to fix this problem.
Gson解析JSON字符串时出现了下面的错误: No-args constructor for class X does not exist. Register an InstanceCreator ...
- C - NP-Hard Problem(二分图判定-染色法)
C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:262144 ...
- Time Consume Problem
I joined the NodeJS online Course three weeks ago, but now I'm late about 2 weeks. I pay the codesch ...
- Programming Contest Problem Types
Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...
- hdu1032 Train Problem II (卡特兰数)
题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能. (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...
- BZOJ2301: [HAOI2011]Problem b[莫比乌斯反演 容斥原理]【学习笔记】
2301: [HAOI2011]Problem b Time Limit: 50 Sec Memory Limit: 256 MBSubmit: 4032 Solved: 1817[Submit] ...
- [LeetCode] Water and Jug Problem 水罐问题
You are given two jugs with capacities x and y litres. There is an infinite amount of water supply a ...
- [LeetCode] The Skyline Problem 天际线问题
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe ...
- PHP curl报错“Problem (2) in the Chunked-Encoded data”解决方案
$s = curl_init(); curl_setopt($s, CURLOPT_POST, true); curl_setopt($s, CURLOPT_POSTFIELDS, $queryStr ...
随机推荐
- stl 和并查集应用
抱歉这么久才写出一篇文章,最近进度有点慢.这么慢是有原因的,我在想如何改进能让大家看系列文章的时候更方便一些,现在这个问题有了答案,在以后的推送中,我将尽量把例题和相关知识点在同一天推出,其次在代码分 ...
- appium python andiroid自动化文档整理笔记
from appium import webdriver import time,unittest,HTMLTestRunner class Testlogin(unittest.TestCase): ...
- [js高手之路] html5 canvas系列教程 - arc绘制曲线图形(曲线,弧线,圆形)
绘制曲线,经常会用到路径的知识,如果你对路径有疑问,可以参考我的这篇文章[js高手之路] html5 canvas系列教程 - 开始路径beginPath与关闭路径closePath详解. arc:画 ...
- 【运维】CPU负载
最近对我的本本(4核8线程)用top命令看系统状况出现了CPU利用率超过200%的情况,非常诧异,查了下相关资料,把这个问题弄清楚了.首先来分析下CPU Load load average: 0.09 ...
- 调试 ASP.NET Core 2.0 源代码
在Visual Studio 2017中可以通过符号以及源链接,非常方便对 ASP.NET Core 2.0中源代码进行调试.在这篇文章中,我们将重点介绍如何使用源链接对ASP.NET Core源进行 ...
- C++拷贝构造函数专题
C++拷贝构造函数 在定义任何C++类时,拷贝空置操作都是必要部分,类需要控制拷贝.赋值和销毁对象时发生的行为.拷贝构造函数的用途:当创建了一个新对象时,可以用另一个对象的数据初始化这个新建的对象. ...
- Problem 2144 Shooting Game fzu
Problem 2144 Shooting Game Accept: 99 Submit: 465Time Limit: 1000 mSec Memory Limit : 32768 KB ...
- Find The Multiple (poj1426 一个好的做法)
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 16505 Accepted: 673 ...
- Manacher’s Algorithm (神啊)
(转载自)http://blog.csdn.net/hopeztm/article/details/7932245 这里描述了一个叫Manacher’s Algorithm的算法. 算法首先将输入字符 ...
- 基于搜狗搜索的微信公众号爬虫实现(C#版本)
Author: Hoyho Luo Email: luohaihao@gmail.com Source Url:http://here2say.me/11/ 转载请保留此出处 本文介绍基于搜狗的微信公 ...