Подразделы

Другие разделы

Дата и время

15/10/2024 12:10:13

Авторизация

Имя:
Пароль:
Зарегистрироваться
Восстановить пароль
 

printThe Travel of the Queen

Ограничения: время – 1s/2s, память – 32MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод copy
Послать решение Blockly Посылки Темы Где Обсудить (1)

Once Alice and Bob decided to play chess, but they found out that a lot of chessmen are missing. Then they invented another game. They needed only chess-clock, chessboard and the queen. The rules of the game are quite easy. The first player puts the queen at any field of the chessboard. Then the players move the queen in turn, starting from the second player. If the player puts the queen on the field, where it has already been, he loses. The game can be completed in a draw, only if the queen has already been on every field of the chessboard, but the player may move the queen on the starting field. The queen can move on any number of fields horizontally, vertically or diagonally.
Suppose, that the game is completed in a draw, and all moves of the first player are known. Restore the moves of the second player.
Input
The input file contains one line with the moves of the first player, separated by one space. Verticals are designated by letters from a through h, and horizontals by numerals.
Output
Write into the output file in the same form the moves made by the second player so, that the game is ended in a draw. If there exist a number of variants, then write any one of them.

Sample Input

a8 a7 c4 d1 b4 a1 a3 c2 b3 b8 c5 d8 b7 c7 d2 d3 h5 e1 h1 f3 f2 g2 e6 f4 g6 e4 f8 g7 e8 g5 h2 h3

Sample Output

a5 a6 a4 b1 c3 a2 c1 b2 b5 d6 b6 c8 c6 d7 d4 d5 e5 h4 f1 e2 g1 g4 e3 g3 f5 e7 f6 f7 g8 h6 h7 h8
Условие задачи на русском языке
loading