标签:
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 show{
    int be;
    int en;
};
bool cmp(show a,show b){
    return a.en<b.en;
}
int main(){
    int n,i,j;
    show my[101];
    while(cin>>n&&n){
        i=0;
        while(i<n){
            cin>>my[i].be>>my[i].en;
            i++;
        }
        sort(my,my+n,cmp);
        int temp=0;
        for(i=0,j=0;i<n;++i){
            if(my[i].be>=temp){
                temp=my[i].en;
                ++j;
            }
        }
        cout<<j<<'\12';
    }
    return 0;
}
标签:
原文地址:http://blog.csdn.net/zp___waj/article/details/46494819