The Templar TestProblem code: KC205 |
All submissions for this problem are available.
Points:10
The greatest enemies of the Brotherhood of Brom in their days were the Templar Knights, a band of highly skilled assassins originally established in 1118 to protect pilgrims and the Holy Sepulcher. Like the Brotherhood s game of testing each other s wits, the Knights too had a game of their own.
The game was played on a board with squares arranged on rows and columns. The pieces used in the game attacked pieces that were either (a) two rows and one column away from its position, or (b) one row and two columns away from its position.
This is exactly the nature of the problem you have been presented with at the finals of the global race in Rio de Janeiro. I n order to develop an unbeatable algorithm for the game, you are to determine the largest number of game pieces that can be placed on a board with M rows and N columns so that no piece is attacking any other. M and N will each be no larger than 500.Input
The first line of input consists of no of test cases T(<100).The next T lines consist of pairs of integers giving values for M and N.(M,N<=500)Output
For each input pair, display the number of pieces that can be appropriately placed.Example
Input:3 2 3 5 5 4 7Output:
4 13 14
| Author: | ankitbabbar |
| Date Added: | 16-10-2009 |
| Time Limit: | 5 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

give me more sample inputs
give me more sample inputs
Here are some sample
Here are some sample inputs:
18 23
10 45
27 46
23 145
give output also
give output also
i need more sample inputs &
i need more sample inputs & outputs.
here are the outputs for the
here are the outputs for the inputs mentioned before:
207
225
621
1668
if M=1 then we can place all
if M=1 then we can place all pieces in N places. Am I right?
what should we print if the
what should we print if the values are < 0
Your program should exit for
Your program should exit for inputs out of the range