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
- 下一篇: [转]拍照怎么搜题?(下)