Mountain Shelter
Time limit1sMemory limit128 MB
Compute the maximum number of dominoes that fit in a W by K grid for up to 10 test cases.
- Level
Easy1 of 10
- Topics
- Math
- Solved
- No attempts yet
Problem
While Hektor was busy working on the HektorJudge project, his colleague Wiktor decided that life should not consist only of sitting in front of a computer, so he set off on a trip to the mountains. When he reached the mountain shelter in the evening, he was surprised to find that he was not the only one who had thought of spending the weekend in the mountains: the shelter was packed with tourists!
In this awkward situation, the shelter's manager had to arrange for the tourists to sleep on the floor of the shelter's main hall. The hall is a rectangle made up of square cells arranged in rows and columns. Each tourist occupies exactly two adjacent cells (touching either horizontally or vertically). What is the maximum number of tourists that can be placed in a hall of the given size so that each cell is used by at most one tourist? Wiktor, being skilled in mathematics and computer science, immediately worked out the correct answer.
Input
The first line contains a natural number (), the number of test sets. The test sets follow, one after another.
Each test set consists of a single line containing two positive integers and (), separated by a single space.
Output
For each test set, print on its own line the maximum number of tourists who can sleep in the shelter hall at the same time. The order of the printed answers must match the order of the test sets in the input.