Timus Online Judge:2010. Sasha the Young Grandmaster

来源:互联网 发布:淘宝购物的步骤 编辑:程序博客网 时间:2024/06/05 23:49

2010. Sasha the Young Grandmaster

Time limit: 0.5 second
Memory limit: 64 MB
Little Sasha is quite determined to learn to play chess. First of all he of course learned how each chess piece could move (except for the pawn as its moving strategy turned out so complicated that Sasha failed to remember them). Then his older brother Oleg came in to check Sasha’s progress. He chose some square on the chessboard and started putting pieces on the square, one by one, asking his little brother: “How many squares are now under attack?”
That was rather stressful for Sasha and he asked you to help him.
The chessboard is a field of n × n square cells. The rook can move any number of cells, but only horizontally or vertically. The bishop can move any number of cells, but only diagonally. The queen can move any number of cells horizontally, vertically or diagonally. The king can move one cell horizontally, vertically or diagonally and the knight makes “L” shaped moves, that is, it moves either one cell horizontally and two cells vertically or two cells horizontally and one cell vertically.

Input

The first line contains an integer n that is the size of the side of the field (1 ≤ n ≤ 108). The second line contains integers x and y that are the coordinates of the cell where Oleg puts the pieces (1 ≤ xy ≤ n).

Output

Output the number of cells that can be hit by king, by knight, by bishop, by rook, and by queen, correspondingly. Follow the format from the sample test.

Sample

inputoutput
85 2
King: 8Knight: 6Bishop: 9Rook: 14Queen: 23
Problem Author: folklore
Problem Source: Ural Regional School Programming Contest 2013

Tags: none  (

hide tags for unsolved problems
)

又是一道水题,直接发代码:


0 0
原创粉丝点击