SOLDIERS - SOLDIERS


Soldiers

Problem Statement:

How many maximum number of soldiers(chess) can be placed in a mxn board so that none of them attack the other.

Input Specification:

The first line is an integer t, denoting the number of test cases. Each test case is a single line with two integers m and n the number of rows and columns in the board.

Output Specification:

For each test case print the maximum number of soldiers that can be placed in a separate line.

Input Constraints:

1 <= t <= 100

1 <= m <= 10^30

1 <= n <= 10^30


Sample Input:

4
10 10
3 3
5 5
3 6

Sample Output:

50
6
15
12

hide comments
sweet_coder_07: 2020-04-21 01:22:51

Last edit: 2020-04-21 01:23:25
vengatesh15: 2017-01-25 16:07:49

simple mistake cost me 1 WA

sumbayak_ae: 2016-04-19 09:04:10

what is the most possible case for segmentation fault (SIGSEGV) ?

fjaquinto: 2013-08-06 12:22:14

how do you handle large numbers in c? used uintmax_t but still not enough to handle the max number possible. pls help. thanks!

reply: Try string

Last edit: 2013-12-12 23:03:31
cegprakash: 2012-04-05 14:53:01

A soldier attacks any other soldier if it is located at it's immediate neighboring diagonal position

Last edit: 2012-01-09 20:27:26

Added by:cegprakash
Date:2012-01-03
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64