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 ...
随机推荐
- 个人从源码理解JIT模式下angular编译AppModule的过程
承接上文.笔者之前将一个angular项目的启动过程分为了两步: 创建平台得到 PlatformRef ,以及执行平台引用提供的方法编译根模块 AppModule .本文就将着眼于创建好的平台,从an ...
- Temperature hdu 3477
Temperature Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- HIT 1917 Peaceful Commission
这道题题意就是给你n对人,一对中编号为x,x+1,给你m对矛盾,表示这两个人不能同时选. 然后就是Two-Sat的模板题了,就是根据对称性,连边,加缩点,最后拓扑排序,求出一组可行解就可以了. #in ...
- ssh项目访问路径及url请求书写
在ssh项目中配置好Struts后,一般可以采用两种方式进行后台请求: 1.html形式,包括a标签,form表单,ajax等.此时的访问链接必须写全路径,可以是相对路径,也可以是绝对路径 相对路径方 ...
- C# 中函数内定义函数的委托方法
//定义委托方法Action(无返回值)Func(有返回值) //无返回值委托 Action<string> SetKeyAndValue = delegate(string key) { ...
- python之HTMLParser解析HTML文档
HTMLParser是Python自带的模块,使用简单,能够很容易的实现HTML文件的分析.本文主要简单讲一下HTMLParser的用法. 使用时需要定义一个从类HTMLParser继承的类,重定义函 ...
- HDU2874 LCA Tarjan
不知道为什么_add2不能只用单方向呢...........调试了好多次,待我解决这个狗血问题 #include <iostream> #include <vector> #i ...
- Mybatis的parameterType传入多个参数
如果查询的条件有多个的时候,mybatis有三种传入方式: 1.通过注解传入 例如: public interface Mapper(){ public User login(@Param(" ...
- Installation of the JDK-9 on ubuntu(linux上安装jdk-9)
Description:Java SE 9 is the latest update to the Java Platform(General Availability on 21 September ...
- checkValidity-表达验证方法。
调用该方法,可以显示对表单元素进行有效验证,返回值是boolean. 代码如下: <!DOCTYPE html> <html> <head> <meta ch ...