| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 46 | 35 | 31 | 75.610% |
After years of planning, you're finally ready to host the Tic-Tac-Toe world championships. Everything had been going great until you made a terrible discovery: the judges, who determine which player has won the game, have been taking bribes! There's not enough time to train new ones, so you opt for a backup plan: you'll create a piece of code that analyzes the board and tells the players if anyone has won.
A Tic-Tac-Toe board looks like the following. Every square can be empty, filled with an X, or filled with a O (capital letter 'o').
Player X has won if they have three X's in a row. Player O wins if they can do the same with the O's. A row can be horizontal, vertical, or diagonal.
Can you write the new judging code and salvage the competition?
The input consists of three lines each with 3ドル$ characters. Each line represents a row on the board. Each character in a line represents a column. This means you have 3ドル$ rows and 3ドル$ columns just like a normal Tic-Tac-Toe board.
Each square in the board contains either an X, O (that's a capital letter, not a number), or E. X and O represent markings made by the players while E represents an empty square.
If player X has won, you should print out the character X. If player O has won, you should print out the character O. If neither player has won, you should print out the character N.
XEO EXO EOX
X
OXO OXX XOX
N
XXE EEX OOO
O
School > CS@Mines > CS@Mines HSPC 2021 I번