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 ...
随机推荐
- js Date() 浏览器兼容问题解决
一般 直接new Date() 是不会出现兼容性问题的,而 new Date(datetimeformatstring) 常常会出现浏览器兼容性问题,为什么,datetimeformatstring中 ...
- vue+axios 前端实现登录拦截(路由拦截、http拦截)
一.路由拦截 登录拦截逻辑 第一步:路由拦截 首先在定义路由的时候就需要多添加一个自定义字段requireAuth,用于判断该路由的访问是否需要登录.如果用户已经登录,则顺利进入路由, 否则就进入登录 ...
- Spring 3.x 读书笔记
第一:如果使用BeanFactory作为Spring Bean的工厂类,则所有的bean都是在第一次使用该Bean的时候实例化 第二:如果使用ApplicationContext作为Spring Be ...
- java文档操作
背景:因是动态报表,1)作成excel模版2)数据填充3)转化为PDF提出解决方法:[open source]1)Apache Poi+I text2) JodConvert+OpenOffice/l ...
- 【Kafka】
KafkaProducer Kafka消息发布客户端. 线程安全,跨线程共享单个生产者实例通常比拥有多个实例的速度更快. 例子,使用生产者发送包含序列号的字符串作为键/值对的记录: Propertie ...
- 宿命的PSS
宿命的PSS 时间限制: 1 Sec 内存限制: 128 MB提交: 60 解决: 37[提交][状态][讨论版] 题目描述 最小生成树P.S.S在宿命的指引下找到了巫师Kismi.P.S.S希望 ...
- 我的第一个python web开发框架(4)——数据库结构设计与创建
小白做好前端html设计后,马上开始进入数据库结构设计步骤. 在开始之前,小白回忆了一下老大在公司里培训时讲过的数据库设计解说: 对于初学者来说,很多拿到原型时不知道怎么设计数据表结构,这是很正常的事 ...
- 机器学习理论提升方法AdaBoost算法第一卷
AdaBoost算法内容来自<统计学习与方法>李航,<机器学习>周志华,以及<机器学习实战>Peter HarringTon,相互学习,不足之处请大家多多指教! 提 ...
- MVC3/4/5/6 布局页及Razor语法及Route路由配置
一.目录结构 二.Razor语法 代码块:@{},如:@{Html.Raw(“”);} @if(){} @switch(){} @for(){} @foreach(){} @while(){} @do ...
- C#仪器数据文件解析-XPS文件
XPS为微软推出的类似于Adobe PDF的一种文件格式,个人认为XPS很好,但毕竟PDF已经被大家所熟知,因此XPS的使用很少,也少有仪器数据输出为该格式. XPS百度百科:https://baik ...