POJ1038

#include <iostream>
#include <stdio.h>
#include <string.h>
#define maxn 200 + 50


using namespace std;


int num[maxn];


int main()
{
    int t, n;
    int st,end;
    int x,y;
    scanf("%d",&t);
    while(t--)
    {
        memset(num,0,sizeof(num));


        int maxtime = 0;
        scanf("%d",&n);
        for( int i = 0; i<n; i++)
        {
            scanf("%d %d",&st, & end);
            x = (st%2 == 1 ? st/2 +1 : st/2);
            y = (end%2 == 1 ? end/2 + 1: end/2);


           int temp = min(x,y);
          for( int j = temp; j<= x+y-temp; j++ )
           {
               num[j] += 10;
               if(maxtime < num[j])
                maxtime = num[j];
           }


        }
        printf("%d\n",maxtime);


    }
}

你可能感兴趣的:(POJ1038)