标签:style http color os io ar for 数据 div
2 2 1 10 10 11 3 1 10 10 11 11 20
1 2
参考代码:
#include<stdio.h> #include<algorithm> using namespace std; struct S { int Bi; int Ei; }a[10001]; int cmp(S a,S b) { return a.Ei<b.Ei; } int main() { int m,n,i,j,k; scanf("%d",&m); while(m--) { scanf("%d",&n); for(i=0;i<n;++i) scanf("%d%d",&a[i].Bi,&a[i].Ei); sort(a,a+n,cmp); k=1; for(i=1,j=0;i<n;++i) { if(a[i].Bi>a[j].Ei) { k++; j=i; } } printf("%d\n",k); } return 0; }
标签:style http color os io ar for 数据 div
原文地址:http://blog.csdn.net/qq_18062811/article/details/39054243