标签:等等 content show sub names pac 处理 更新 ane
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 55813 Accepted Submission(s): 30009
1 #include <bits/stdc++.h> 2 using namespace std; 3 struct node 4 { 5 int start,end; 6 }p[105]; 7 bool cmp(node x,node y) 8 { 9 if(x.start<y.start&&x.end<y.end) 10 return true; 11 if(x.start==y.start&&x.end<y.end) 12 return true; 13 return false; 14 } 15 int main() 16 { 17 int n; 18 while(scanf("%d",&n)&&n) 19 { 20 for(int i=0;i<n;i++) 21 scanf("%d%d",&p[i].start,&p[i].end); 22 sort(p,p+n,cmp); 23 node m=p[0]; 24 int ans=1; 25 for(int i=1;i<n;i++) 26 { 27 if(p[i].start>=m.end) 28 { 29 ans++; 30 m=p[i]; 31 } 32 } 33 printf("%d\n",ans); 34 } 35 return 0; 36 }
标签:等等 content show sub names pac 处理 更新 ane
原文地址:http://www.cnblogs.com/ECJTUACM-873284962/p/6669947.html