hdu 1050 重疊 rom

Moving Tables

#include<stdio.h>   
#include<string.h>
#define N 210
int room[N];
void swap(int &a,int &b){
    int c;
    c = a;
    a = b;
    b = c;
}


int main(){
    int i,j,n,t,a,b;
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);     memset(room, 0, sizeof(room));int min = 0;
        for(i=0;i<n;i++){
            scanf("%d%d",&a,&b);
            a = (a -1)/2;
            b = (b -1)/2;
            if(a>b)
            {
                swap(a,b);
            }
            
            for(j = a;j<=b;j++){
                room[j]++;
                if(room[j]>min)
                    min = room[j];
            }
        }printf("%d\n",min*10);
    }
return 0;
}


 

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