12 1 3 3 4 0 7 3 8 15 19 15 20 10 15 8 18 6 12 5 10 4 14 2 9 0
5
<span style="font-size: 24px; ">#include<stdio.h> #include<iostream> #include<algorithm> #define M 1000 using namespace std; struct node { int x,y; }p[M]; bool cmp(node a,node b) { return (a.y<b.y); } int main () { int t; int i,k,l; while(~scanf("%d",&t)&&t) { for(i=0;i<t;i++) scanf("%d%d",&p[i].x,&p[i].y); sort(p,p+t,cmp); k=p[0].y; l=1; for(i=1;i<t;i++) { if(p[i].x>=k) { k=p[i].y; l++; } } printf("%d\n",l); } return 0; }</span>
hdu 2037 今年暑假不AC,布布扣,bubuko.com
原文:http://blog.csdn.net/fyxz1314/article/details/37825125