AC代码:
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #define Max 250 using namespace std; struct object { int start; int end; }a[Max]; long long b[405]; int main(void) { freopen("in.txt","r",stdin); int N; while(scanf("%d",&N)!=EOF) { while(N--) { memset(b,0,sizeof(b)); int n; long long max=0; scanf("%d",&n); for(int i=1;i<=n;i++) //输入 scanf("%d%d",&a[i].start,&a[i].end); for(int i=1;i<=n;i++) { if(a[i].start>a[i].end) { int temp; temp=a[i].end; a[i].end=a[i].start; a[i].start=temp; } if(a[i].start%2==0) a[i].start--; if(a[i].end%2==1) a[i].end++; for(int j=a[i].start;j<=a[i].end;j++) b[j]++; } for(int i=1;i<=400;i++) if(max<b[i]) max=b[i]; printf("%lld ",max*10); } } fclose(stdin); return 0; }