CF462A.Appleman and Easy Task

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?

Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the board are adjacent if they share a side.

Toastman 提出了一个非常简单的任务。他将这个任务交给了 Appleman,但 Appleman 不知道如何解决它。你能帮他吗?

给定一个 n×nn \times n 的棋盘。棋盘的每个格子中要么是字符 'x',要么是字符 'o'。是否成立:棋盘上每个格子的相邻格子中,字符 'o' 的个数均为偶数?若两个格子有一条公共边,则称它们相邻。

输入格式

The first line contains an integer n (1 ≤ n ≤ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.

第一行包含一个整数 nn(1≤n≤1001 \leq n \leq 100)。接下来的 nn 行描述了棋盘,每行包含 nn 个字符(仅由 'x' 或 'o' 组成),字符间无空格。

输出格式

Print "YES" or "NO" (without the quotes) depending on the answer to the problem.

根据问题的答案,输出 “YES” 或 “NO”(不带引号)。

输入输出样例

  • 输入#1

    3
    xxo
    xox
    oxx

    输出#1

    YES
  • 输入#2

    4
    xxxo
    xoxo
    oxox
    xxxx

    输出#2

    NO

输入解题思路,AI测评打分。不知道怎么写?

首页