1318.cpp

来自「这是哈尔滨工业大学acmOJ的源代码」· C++ 代码 · 共 53 行

CPP
53
字号
/*  This Code is Submitted by wywcgs for Problem 1318 on 2005-11-22 at 15:50:53 */ 
#include <cstdio>
#include <cstring>

const int MAX = 256;

void parse(int&);

int main()
{
	int cov[MAX];
	int T, t, n, max;
	int i, j, begin, end;
	
	scanf("%d", &T);
	for(t = 0; t < T; t++) {
		scanf("%d", &n);
		memset(cov, 0, sizeof(cov));
		for(i = 0; i < n; i++) {
			scanf("%d %d", &begin, &end);
			parse(begin);
			parse(end);
			if(begin < end) {
				for(j = begin; j <= end; j++) {
					cov[j]++;
				}
			} else {
				for(j = end; j <= begin; j++) {
					cov[j]++;
				}
			}
		}
		max = 0;
		for(i = 0; i < MAX; i++) {
			if(cov[i] > max) {
				max = cov[i];
			}
		}
		printf("%d\n", max*10);
	}
	
	return 0;
}

void parse(int &a)
{
	if(a % 2 == 0) {
		a--;
	}
	a /= 2;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?