1.25 Tic-tac-toe
https://acs.jxnu.edu.cn/problem/CF3Chttps://acs.jxnu.edu.cn/problem/CF3C
描述:
Certainly, everyone is familiar with tic-tac-toe game. The rules are very simple indeed. Two players take turns marking the cells in a?3?×?3?grid (one player always draws crosses, the other — noughts). The player who succeeds first in placing three of his marks in a horizontal, vertical or diagonal line wins, and the game is finished. The player who draws crosses goes first. If the grid is filled, but neither Xs, nor 0s form the required line, a draw is announced.
最近,每個人都對井字游戲很感興趣。規則很簡單。兩個玩家輪流在3×3的方格中畫標記(一個玩家通常畫圓,一個畫叉)。首先成功地將他的三個標記放置在水平、垂直或對角線上的玩家獲勝,且游戲結束。畫X的玩家先畫。如果網格已填滿,但 X 和 0 均未形成所需的行,則宣布平局。
You are given a?3?×?3?grid, each grid cell is empty, or occupied by a cross or a nought. You have to find the player (first or second), whose turn is next, or print one of the verdicts below:
給你一個 3 × 3 網格,每個網格單元是空的,或者被X或?占據。 您必須找到下一個輪到的玩家(第一個或第二個),或打印以下判決之一:
- illegal?— if the given board layout can't appear during a valid game;
- the first player won?— if in the given board layout the first player has just won;
- the second player won?— if in the given board layout the second player has just won;
- draw?— if the given board layout has just let to a draw.
- 非法的——如果給定的期盼布局不能有效地出現在棋盤里。
- 第一個玩家獲勝——在給定的棋盤中出現第一個玩家獲勝。
- 第二個玩家獲勝——如果在給定的棋盤中出現第二個玩家獲勝。
- 平局——如果在給定的棋盤中出現平局的情況。
輸入:
The input consists of three lines, each of the lines contains characters ".", "X" or "0" (a period, a capital letter X, or a digit zero).
輸入包含3行,每一行包含符號".", "X" or "0"(句點、大寫字母 X 或數字零)。
輸出:
Print one of the six verdicts:?first,?second,?illegal,?the first player won,?the second player won?or?draw.
輸出一下六種情況之一:第一個,第二個,非法,第一個玩家獲勝,第二個玩家獲勝或者平局。
樣例輸入:
X0X .0. .X.樣例輸出:
second總結
以上是生活随笔為你收集整理的1.25 Tic-tac-toe的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: DL1 - Neural Network
- 下一篇: [转]拍照怎么搜题?(下)