Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
数据都对,怎么不能过啊#include <stdio.h> struct { int x,y; }a[205]; int main(int argc, char *argv[]) { int m,n,i,j,max,k; scanf("%d",&n); while(n--) { scanf("%d",&m); for(i=0;i<m;i++) { scanf("%d",&a[i].x); if(a[i].x%2) a[i].x++; scanf("%d",&a[i].y); if(a[i].y%2) a[i].y++; if(a[i].x>a[i].y) { k=a[i].x; a[i].x=a[i].y; a[i].y=k; } } for(i=1;i<m;i++) for(j=0;j<m-i;j++) if(a[j].y>a[j+1].y) { k=a[j].x; a[j].x=a[j+1].x; a[j+1].x=k; k=a[j].y; a[j].y=a[j+1].y; a[j+1].y=k; } max=1; for(i=0;i<m;i++) { k=1; for(j=i+1;j<m;j++) if(a[j].x>a[i].x&&a[j].x<a[i].y) { a[i].x=a[j].y; k++; if(k>max) max=k; } else if(a[j].x<=a[i].x||a[j].x==a[i].y) { k++; if(k>max) max=k; } } printf("%d\n",max*10); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator