就是找一个区间,其被覆盖次数最多,输出即可。。
/* * hdu1050/win.cpp * Created on: 2012-7-27 * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> #include <iostream> #include <algorithm> #include <queue> #include <set> #include <map> #include <stack> #include <string> #include <vector> #include <deque> #include <list> #include <functional> #include <numeric> #include <cctype> using namespace std; const int MAXN = 205; int used[MAXN]; int main() { #ifndef ONLINE_JUDGE freopen("data.in", "r", stdin); #endif int T, a, b, M; scanf("%d", &T); while(T--) { memset(used, 0, sizeof(used)); scanf("%d", &M); for(int i = 0; i < M; i++) { scanf("%d%d", &a, &b); a = (a + 1) / 2; b = (b + 1) / 2; if(a > b) { a = a ^ b; b = a ^ b; a = a ^ b; } for(int k = a; k <= b; k++) { used[k]++; } } int ans = 0; for(int i = 0; i < MAXN; i++) { if(used[i] > ans) { ans = used[i]; } } printf("%d\n", ans * 10); } return 0; }