/*
* hdu-2037
* mike-w
* 2012-4-15
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_SIZE 128
int f[MAX_SIZE][2];
int N;
int comp(const void *e1, const void *e2)
{
return *((int*)e1+1) - *((int*)e2+1);
}
int main(void)
{
#ifndef ONLINE_JUDGE
freopen("in","r",stdin);
#endif
int i,count,time;
while(scanf("%d",&N),N>0)
{
for(i=0;i<N;i++)
scanf("%d%d",f[i],f[i]+1);
qsort(f,N,sizeof(int[2]),comp);
count=0;
time=0;
for(i=0;i<N;i++)
if(f[i][0]>=time)
count++,time=f[i][1];
printf("%d\n",count);
}
return 0;
}
HDU-2037 贪心
最新推荐文章于 2018-12-20 16:10:51 发布
705

被折叠的 条评论
为什么被折叠?



