Consider a square chessboard with
A queen can move vertically, horizontally or diagonally. As an example, consider the square chessboard with ♕
notation) in Figure 1 below. The cells that can be reached by the queen are marked with the ◯
notation. There are
Your task is to calculate the number of cells that are NOT reachable by any queens.
Input Specification
The first line contains two integers,
Output Specification
The number of cells that are not reachable by any queens.
Sample Input 1
6 1
4 3
Output for Sample Input 1
16
Sample Input 2
6 2
4 3
6 4
Output for Sample Input 2
9
Explanation
Figure 1 and Figure 2 correspond to Sample 1 and Sample 2, respectively.
Comments
This comment is hidden due to too much negative feedback. Show it anyway.