#include<iostream>//left<right,按结束时间早排序
#include<algorithm>
using namespace std;
struct play{
int left,right;
}p[105];
bool compare (play a,play b){
return a.right <b.right;
}
int main(){
int n;
while(cin>>n&&n){
for(int i=0;i<n;i++)
cin>>p[i].left>>p[i].right;
sort(p,p+n,compare);
int sum=1;
int r=p[0].right;
for(int i=1;i<n;i++){
if(p[i].left>=r){
sum++;
r=p[i].right;
}
}
cout<<sum<<endl;
}
return 0;
}
hdu2037
最新推荐文章于 2019-08-24 21:58:00 发布