[BOJ 13227] TicTacToe

View as PDF

Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 512M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

We want to create a program to check the result of a tic tac toe game. A tic tac toe board is a 3x3 grid. Each position can contain either X or O. The game finishes with a winner when a player creates a straight line of 3 equal symbols. The next 3 boards show finished games with a winner. The empty positions are represented using dots. </p>

X.X     OX.    .X.
OOO     .O.    .X.
...     X.O    .XO

In contrast, these 3 boards have not finished with a winner.

OXO    X..    ...
XXO    O.O    .X.
OOX    .XX    ..O
## 입력 형식

The test case consists of 3 lines. Each one with 3 characters (dot, O or X). Note that we are using the letter “O” not the digit zero.

출력 형식

For each test case, write YES if the board finished with a winner or NO if there is no winner.

예제 입력 1

XXX
.OO
OO.

예제 출력 1

YES

예제 입력 2

XOX
OXO
OXO

예제 출력 2

NO

Comments

There are no comments at the moment.