其他分享
首页 > 其他分享> > 【无标题】

【无标题】

作者:互联网

2022.1.21

题目网址:

https://acs.jxnu.edu.cn/problem/CF3C

原题:

Tic-tac-toe

 1000ms  65536K

描述:

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.

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:

输入:

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).

输出:

Print one of the six verdicts: first, second, illegal, the first player won, the second player won or draw.

翻译:

描述:

可以确切地说,每个人都熟悉井字游戏。规则也的确非常简单。两个玩家在一个3*3的网格中轮流标记单元格(一个玩家总是画叉,另一个画0)。首先成功地在一个水平线上,竖直位置,斜线标记了连续三个记号的玩家胜利,游戏结束。画叉的玩家先开始画。如果网格被填满了,但是叉和0都没有形成所要求的线,就宣布是平局。

你被给一个3*3的网格,每个单元格都是空的,或者被一个叉或者一个0占领。你必须去找到下一个轮到的玩家(第一或者第二),或者打印以下判决之一:

不合法---如果被给的数据布局中没有出现一个有效的游戏结果;

第一个玩家赢了---如果在被给的数据布局中第一个玩家已经赢了;

第二个玩家赢了---如果在被给的数据布局中第二个玩家已经赢了;

平局---如果被给的数据布局中已经变成了平局;

输入:

输入包含三行,每一行包括字符“.”,“X”或者“0”(一个句点,一个大写字母X,或者一个数字0)。

输出:

打印这六个判决之一:第一,第二,不合法,第一个玩家赢了,第二个玩家赢了,或者平局。

标签:given,无标题,玩家,player,second,won,first
来源: https://blog.csdn.net/qq_61768389/article/details/122614881