标签:des style io ar color os sp java for
12 1 3 3 4 0 7 3 8 15 19 15 20 10 15 8 18 6 12 5 10 4 14 2 9 0
5
#include<iostream>
#include<algorithm>
using namespace std;
struct ac{
int s;
int e;
}t[110];
int cmp(struct ac a,struct ac b)
{
return a.e<b.e;
}
int main()
{
int n,i;
while(cin>>n&&n)
{ int num=1;
for(i=0;i<n;i++)
cin>>t[i].s>>t[i].e;
sort(t,t+n,cmp);
int end=t[0].e;
for(i=1;i<n;i++)
{
if(t[i].s>=end)
{
num++;
end=t[i].e;
}
}cout<<num<<endl;
}
return 0;
}标签:des style io ar color os sp java for
原文地址:http://blog.csdn.net/fwjynll/article/details/41496125