**Problem :**

Time Limit: 1 second(s) Memory Limit: 32 MB

Given an m x n chessboard where you want to place chess knights.

You have to find the number of maximum knights that can be placed

in the chessboard such that no two knights attack each other.

A chess knight can attack 8 positions in the board as shown in the picture below.

Sample Input

3

8 8

3 7

4 10

Output for Sample Input

Case 1: 32

Case 2: 11

Case 3: 20

See the problem in CodeShef .

**Solution Algorithm :**

- For n or m equal to 1, the answer is m * n
- For n or m equal to 2, there are special Cases.
- For other cases, (m*n + 1) / 2, because only the different colors of the grid can attack one another, so long as a certain color grid put full wants, pick…

View original post 103 more words

Advertisements