好裸的贪心啊。。
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
struct day
{
int s,e;
}a[1010];
bool operator<(const day&x,const day&y)
{
return x.e<y.e;
}
int main()
{
int n;
while(scanf("%d",&n)==1&&n)
{
int i;
for(i=0;i<n;i++)
{
scanf("%d%d",&a[i].s,&a[i].e);
}
sort(a,a+n);
int ans=1;
for(i=1;i<n;i++)
{
if(a[i].s>=a[i-1].e)
ans++;
else
{
a[i].e=a[i-1].e;
}
}
printf("%d\n",ans);
}
return 0;