HDU1050 區間覆蓋

 

#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

const int MaxNum = 205;
int p[MaxNum];

int main()
{
	//freopen("HDU1050.txt","r",stdin);
	int n,m,s,t,tmp;
	scanf("%d",&n);
	while(n--)
	{
			memset(p,0,sizeof(p));
			scanf("%d",&m);
			while(m--)
			{
				scanf("%d%d",&s,&t);
				s = (s - 1) >> 1;
				t = (t - 1) >> 1;
				if(s > t)
				{
					tmp = s;
					s = t;
					t = tmp;
				}
				for(int j = s;j <= t;j++)
					p[j]++;
			}
			int max = -1;
			for( int j = 0; j < MaxNum; j++)
				if(p[j] > max)
					max = p[j];
			cout<<10*max<<endl;
	}
	
	return 0;
}


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章