题库练习 Chess
← 上一题 下一题 →

A7928 | Chess

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Two chess pieces, a rook and a knight, stand on a standard chessboard $8×8$ in size. The positions in which they are situated are known. It is guaranteed that none of them beats the other one.

Your task is to find the number of ways to place another knight on the board so that none of the three pieces on the board beat another one. A new piece can only be placed on an empty square.

输入格式

The first input line contains the description of the rook's position on the board. This description is a line which is 2 in length. Its first symbol is a lower-case Latin letter from a to h, and its second symbol is a number from 1 to 8. The second line contains the description of the knight's position in a similar way. It is guaranteed that their positions do not coincide.

输出格式

Print a single number which is the required number of ways.

输入输出样例

输入 #1
a1
b2
输出 #1
44
输入 #2
a8
d4
输出 #2
38
C++ 编辑器
输入
输出