这题~~。。。 没看别人解题实在想不出来啊
膜拜大神
利用房间号分割走廊,每条“子走廊”都设置一个计数器,每经过一次+1,完了最后对计数器快排,最大的次数X10就是答案
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int maxn=205;
int room[maxn];
bool bans[maxn];
int main()
{
int l,r,T,n;
scanf("%d",&T);
while(T--)
{
memset(room,0,sizeof(room));
int i,n;
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&l,&r);
if(r<l)
{
int t=l;
l=r;
r=t;
}
memset(bans,0,sizeof(bans));
for(i=l;i<=r;i++)
{
bans[(i+1)>>1]=true;
}
for(i=1;i<=maxn;i++)
{
if(bans[i])
{
room[i]++;
}
}
}
sort(room,room+maxn);
printf("%d\n",room[maxn-1]*10);
}
return 0;
}