// BlueEyes' Schedule.cpp : 定义控制台应用程序的入口点。
//
//#include "stdafx.h"
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 1005;
struct node{
int x, y;
bool operator<( const node &a )const{
return y < a.y;
}
}edge[ maxn ];
//int _tmain(int argc, _TCHAR* argv[])
int main()
{
int n;
while( cin >> n ){
if( !n )
break;
for( int i = 0; i < n; ++i )
cin >> edge[ i ].x >> edge[ i ].y;
sort( edge, edge + n );
int ans = 1;
for( int i = 1; i < n; ++i ){
if( edge[ i ].x >= edge[ i - 1 ].y )
ans++;
else{
edge[ i ].y = edge[ i - 1 ].y;
}
}
cout << ans << endl;
}
return 0;
}
BlueEyes' Schedule
最新推荐文章于 2024-07-15 17:53:06 发布