poj 1083 Moving Tables

/*
* poj 1083 Moving Tables
* antsmall
* 2010-11-9 
*/
#include<iostream>
#include<cmath>
using namespace std;

int main()
{
int t, n, a, b, tmp;
int l, h;
int pts[201];
int heaviest;
scanf("%d", &t);
while(t--) {
   scanf("%d", &n);
   memset(pts, 0, sizeof(pts));
   heaviest = 1;
   for(int i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    if(a > b) {tmp = a; a = b; b = tmp;}
    l = ceil(a/2.0); h = ceil(b/2.0);
    for(int j = l; j <= h; j++) pts[j]++;
   }
   for(int i = 1; i <= 200; i++) 
    if(pts[i] > heaviest) heaviest = pts[i];
   printf("%d\n", 10*heaviest);
}
//system("pause");
return 0;
}

你可能感兴趣的:(J#)