Create 7483.cpp

Accepted on VirtualJudge Online : http://acm.hust.edu.cn/vjudge/contest/view.action?cid=115784#problem/F
This commit is contained in:
Kirigaya Kazuto 2016-05-07 19:10:04 +08:00
parent cde9f20e7a
commit 200530a6ca

50
UVALive/7483.cpp Normal file
View File

@ -0,0 +1,50 @@
/**
LINK=
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=115784#problem/F
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <vector>
#include <algorithm>
using namespace std;
#define MAXN 105
int main()
{
int n;
while(scanf("%d",&n)==1)
{
vector<int> pool[MAXN*2+8];
for(int i=0;i<n;i++)
{
int a,b;
scanf("%d %d",&a,&b);
pool[a].push_back(b);
}
int k=INT_MAX;
int cnt=0;
for(int i=0;i<MAXN*2+8;i++)
{
if(k<i)
{
++cnt;
k=INT_MAX;
}
for(int j=0;j<pool[i].size();j++)
{
k=min(k,pool[i].at(j));
}
}
if(k<INT_MAX)
{
++cnt;
}
printf("%d\n",cnt);
}
/// End of main loop
return 0;
}