D. Конь Атіли

Вибачте, але цю сторінку ще не перекладено на українську мову For the sake of viewer convenience, the content is shown below in one of the available alternative languages. You may click one of the links to switch the site language to another available language.

2 sec, 256 M

Grass does not grow where my horse has stepped
Atilla

It is not a secret that the ONU students have no relation to the looting of ancient Rome. At least, there is no surviving witness to the contrary. But this does not prevent a student of Demotivation Technologies Jeannette Sledgehammer and Vasilisa Antropomorphovich to have fun on a lesson of Computer Reanimation playing "Atilla’s horse".

The point of this game is quite simple: 8x8 cells on the board is a map of Rome - some cells are building, and the rest - the streets and squares (we call them empty). One of the empty cells is a formidable leader of the Huns, seated on a horse. Players make their moves in turn, beginning with Jeannette. In one move is allowed to move Atilla on a horse by chess rules of knight stroke while riding is prohibited to call in the houses (after all, Rome is a Cultural Capital of the World). You also can not go to the cell, trampled the horse before, because there is no grass growing (it is not so easy to take on himself the leader of the Huns, and not to have one). The player who can’t make a move loses.

The teacher of Computer Reanimation frustrating is kill-time girls. It is well known that the outcome of the game is predetermined by starting position, is only to play on the optimal strategy. So he decided to write a program as quickly as possible to answer the question of who will win. But, as we know, "decided to do" and "done" - are two big differences. So write the program themselves so quickly.

Input. 8 lines of 8 characters indicating the starting position of the game are served on input. The symbol '.' is an empty cage, '*' is a cell occupied by a building, 'K' is a cell where Attila is on horseback. Rome is quite densely populated city, so occupied cells is present at least 25.

Output. If Jeannette wins, output the line "Congratulations to Jeannette". Otherwise output "Congratulations to Vasilisa".

Input Output
..*..*..

.**.*..*

***..*..

..*K....

..**.*..

..***...

..***.**

*......*

Congratulations to Jeannette

 

Idea – Oleg Alexandrovich Petrov

About the post author Igor Mazurok (5 Posts)

PhD in Computer Science, Associate professor of Department Applied Mathematics of Odessa I.I.Mechnikov National University, Ukraine KBIS Software Developer

Author Info

Igor Mazurok

PhD in Computer Science, Associate professor of Department Applied Mathematics of Odessa I.I.Mechnikov National University, Ukraine
KBIS Software Developer

Leave a Reply