#include<iostream>
#include<algorithm>
using namespace std;
struct tv{
int begin; //开始时间
int end; //结束时间
};
bool cmp(tv* a,tv* b)
{
return a->end<b->end;
}
int main()
{
int n;
tv* t[101];
while(1){
cin>>n;
int count=1;
if(!n) break;
int i;
for(i=0;i<n;i++){
t[i]=new tv();
cin>>t[i]->begin>>t[i]->end;
}
sort(t,t+n,cmp);
int end=t[0]->end;
int p;
for(p=1;p<=n-1;p++){
if(t[p]->begin>=end){
count++;
end=t[p]->end;
}
}
cout<<count<<endl;
}
return 0;
}
hoj2037 今年暑假不AC
最新推荐文章于 2018-07-31 11:36:03 发布