Logo
(追記) (追記ここまで)

34386번 - Tic-Tac-Toe AI 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB80634478.571%

문제

After you helped to save last year's Tic-Tac-Toe World Championships, you were given a grant to write a new tic-tac-toe AI to determine the best move to play.

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.

Given the player whose turn it is, and a board where there is one winning move for that player, can you output the row and column where that player should play?

입력

The first line of the input is either X or O, representing the player whose turn it is.

The next three lines each have 3ドル$ characters. Each of these lines represents a row on the board. Each character in a line represents a square in that row. 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. An X or O represents markings made by the players while E represents an empty square.

Input Restrictions

  • It is guaranteed that there will be one and only one square that will win the game for the player specified on the first line.
  • The input may not necessarily represent a valid tic-tac-toe game state. That is, one of the players may have skipped some of their turns.

출력

Output two space-separated integers representing the row and the column where the player should play. Note, the rows and columns are 1ドル$-indexed, so if the player should play in the top left corner, then you should output "1ドル$ 1ドル$".

제한

예제 입력 1

X
XXE
EOO
OXX

예제 출력 1

1 3

예제 입력 2

O
OXX
EOO
OXX

예제 출력 2

2 1

노트

출처

School > CS@Mines > CS@Mines HSPC 2022 > Beginner G번

  • 문제를 만든 사람: Sumner Evans
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /