#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#pragma warning(disable:4996)
#include<cstdio>
#include<cstdlib>
using std::cin;
using std::cout;
using std::endl;
using std::stringstream;
using std::string;
using std::vector;
using std::list;
using std::pair;
using std::set;
using std::multiset;
using std::map;
using std::multimap;
using std::stack;
using std::queue;
using std::priority_queue;
bool compare(const pair<int,int>&a,const pair<int,int>&b)
{
return a.second < b.second;
}
int main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int n;
while (cin >> n&&n)
{
vector<pair<int, int>>program(n);
for (int i = 0; i < n; i++)
{
cin >> program[i].first >> program[i].second;
}
std::sort(program.begin(),program.end(),compare);
int count = 1, curtime = program[0].second;
for (int i = 1; i < n; i++)
{
if (curtime <= program[i].first)
{
curtime = program[i].second;
count++;
}
}
cout << count << endl;
}
return 0;
}
hdu_1037_今年暑假不AC
最新推荐文章于 2019-07-22 23:47:27 发布