这道题看着很难,看了discuss上面的这个这个讨论:
http://poj.org/showmessage?message_id=123867
后发现其实挺简单的。解法在上述链接中。
thestoryofsnow | 1083 | Accepted | 152K | 0MS | C++ | 962B |
/*
ID: thestor1
LANG: C++
TASK: poj1083
*/
#include <iostream>
#include <fstream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <limits>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cassert>
using namespace std;
const int NROOMS = 200;
int main()
{
int T;
scanf("%d", &T);
int corridor[NROOMS] = {0};
for (int no = 0; no < T; ++no)
{
memset(corridor, 0, sizeof(corridor));
int N, s, t, tmp;
scanf("%d", &N);
for (int n = 0; n < N; ++n)
{
scanf("%d%d", &s, &t);
if (s > t)
{
tmp = s, s = t, t = tmp;
}
if (s % 2 == 0)
{
s--;
}
if (t % 2 == 0)
{
t--;
}
s /= 2, t /= 2;
for (int i = s; i <= t; ++i)
{
corridor[i]++;
}
}
printf("%d\n", *max_element(corridor, corridor + NROOMS) * 10);
}
return 0;
}