POJ1083-Moving Tables解题报告
Moving TablesThe famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.


The input consists of T test cases. The number of test cases ) (T is given in the first line of the input file. Each test case begins with a line containing an integer N , 1 <= N <= 200, that represents the number of tables to move.
Each of the following N lines contains two positive integers s and t, representing that a table is to move from room number s to room number t each room number appears at most once in the N lines). From the 3 + N -rd
line, the remaining test cases are listed in the same manner as above.
The output should contain the minimum time in minutes to complete the moving, one per line.
Taejon 2001
#include<iostream>#include<algorithm>using namespace std;int testcases,movetimes,room[402],from,to,i,j,temp;int main(){cin >> testcases;while(testcases --){memset(room,0,sizeof(room));cin >> movetimes;while(movetimes --){cin >> from >> to;if(from > to){temp = from;from = to;to = temp;}if(from % 2 != 0){from ++;}if(to % 2 != 0){to ++;}for(i = from; i <= to; i+=2)room[i]++; }sort(room,room + 402);cout << room[401] * 10 <<endl;}system("pause");return 0;}