Preparando MOJI

Chess

2000ms 262144K

Description:

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.

Input:

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.

Output:

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

Sample Input:

a1
b2

Sample Output:

44

Sample Input:

a8
d4

Sample Output:

38

Informação

Codeforces

Provedor Codeforces

Código CF38B

Tags

brute forceimplementationmath

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 08:28:01

Relacionados

Nada ainda