Chess Queen
来源:UVA
标签:数论
参考资料:
相似题目:
题目
You probably know how the game of chess is played and how chess queen operates. Two chess queens are in attacking position when they are on same row, column or diagonal of a chess board. Suppose two such chess queens (one black and the other white) are placed on (2 × 2) chess board. They can be in attacking positions in 12 ways, these are shown in the picture below:
Given an (N × M) board you will have to decide in how many ways 2 queens can be in attacking position in that.