poj_1083

開始沒有考慮這樣的情況 1->3 4->5這種情況,因爲過道是兩邊,正對面的會存在衝突。

#include <iostream>
#include <memory.h>
using namespace std;

int f[1000];
int main()
{
    int t,n;
//freopen("1.txt","r",stdin);
	scanf("%d",&t);
	while(t--)
	{
	   scanf("%d",&n);
	   
	   int i;
	   int max=1;
	   for(i=0;i<1000;i++)
		   f[i]=0;
	   for(i=0;i<n;i++)
	   {
		   int b,e;
		   scanf("%d%d",&b,&e);
		   int t;
		   if(b>e) {t=e;e=b;b=t;}
		   for(int j=(b+1)>>1;j<=(e+1)>>1;j++)
		   {
			   f[j]++;
			    if(max<f[j])max=f[j];
		   }
	   }


		  
		   cout<<max*10<<endl;
	}
   return 0;
}


發佈了41 篇原創文章 · 獲贊 2 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章