HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


51014 - Nine Men's Morris game

Guest
• Review clarifications (1)

Section problems

• 51015 - Student Scholarships
• 50982 - A thief in labyrinth
• 51091 - Guess the number - 1
• 51008 - Sum of Regional Maxes
• 50989 - Rectangles and Points
• 51020 - Number of nodes removed
• 50932 - Shifting rows and columns
• 51141 - Most valuable stock items
• 51014 - Nine Men's Morris game
• 51019 - Finding the hidden message
• 50497 - Falling Bricks - Revisited
• 50933 - Sum of the Biggest Neighbors
• 51100 - Minimum time to exit building
• 50444 - n digit kth number divisible...
• 50865 - Apartment Building Adminis...
• 51089 - Multiply a row and add it to ...
• 50874 - Apartment Building Adminis...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Nine Men's Morris game

In Nine Men's Morris game, the players try to place their pieces on adjacent points so that they can remove one of the opponent pieces. For example the pieces on b2, d2 and f2 are adjacent on a line. Similarly, the pieces on d7, d5 and d6 are also adjacent on a line. But the pieces on b4, c4 and e4 are not adjacent on a line.

Question: Write a program that reads the positions of 4 pieces and decides if any three are adjacent on a line.

Input specification: You will be given the coordinates of 4 pieces, a letter and an integer separated by a space.

Output specification: Show "Yes" if any three are adjacent on a line, or "No" otherwise.

Sample Input 1
a7 d6 d7 g7

Sample Input 2
b4 c4 e4 g4
Sample Output 1
Yes
Sample Output 2
No

Explanation: In the first sample, the pieces a7, d7, and g7 are aligned on a line.
In sample 2, no three pieces are aligned on a line.



Для отправки решений необходимо выполнить вход.

www.contester.ru