301459: CF275A. Lights Out

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Lights Out

题意翻译

### 题目描述 $Lenny$ 正在操作一个 $3×3$ 大小的网格。 在游戏开始时,所有数都为 $1$ 。 操作任何一个指示灯都会改变它以及它上下左右四个相邻的网格(要在 $3×3$ 网格内)。每次操作时,所有需要改变的数均由 $0$ 变为 $1$ 或者由 $1$ 变为 $0$ 。 现在 $Lenny$ 已经操作了每一格一定次数。给定每个方格的操作次数,请输出每个方格的最终数值。 ### 输入格式 输入共三行,每行包含三个整数 $x$ ( $0 \leqslant x \leqslant 100$ )。 第 $i$ 行的第 $j$ 个数表示操作网格的第 $i$ 行的第 $j$ 个方格的次数。 ### 输出格式 输出三行,每行三个整数。第 $i$ 行的第 $j$ 个方格的数表示该方格的最终数值( $0$ 或 $1$)。

题目描述

Lenny is playing a game on a $ 3×3 $ grid of lights. In the beginning of the game all lights are switched on. Pressing any of the lights will toggle it and all side-adjacent lights. The goal of the game is to switch all the lights off. We consider the toggling as follows: if the light was switched on then it will be switched off, if it was switched off then it will be switched on. Lenny has spent some time playing with the grid and by now he has pressed each light a certain number of times. Given the number of times each light is pressed, you have to print the current state of each light.

输入输出格式

输入格式


The input consists of three rows. Each row contains three integers each between 0 to 100 inclusive. The $ j $ -th number in the $ i $ -th row is the number of times the $ j $ -th light of the $ i $ -th row of the grid is pressed.

输出格式


Print three lines, each containing three characters. The $ j $ -th character of the $ i $ -th line is "1" if and only if the corresponding light is switched on, otherwise it's "0".

输入输出样例

输入样例 #1

1 0 0
0 0 0
0 0 1

输出样例 #1

001
010
100

输入样例 #2

1 0 1
8 8 8
2 0 3

输出样例 #2

010
011
100

Input

题意翻译

### 题目描述 $Lenny$ 正在操作一个 $3×3$ 大小的网格。 在游戏开始时,所有数都为 $1$ 。 操作任何一个指示灯都会改变它以及它上下左右四个相邻的网格(要在 $3×3$ 网格内)。每次操作时,所有需要改变的数均由 $0$ 变为 $1$ 或者由 $1$ 变为 $0$ 。 现在 $Lenny$ 已经操作了每一格一定次数。给定每个方格的操作次数,请输出每个方格的最终数值。 ### 输入格式 输入共三行,每行包含三个整数 $x$ ( $0 \leqslant x \leqslant 100$ )。 第 $i$ 行的第 $j$ 个数表示操作网格的第 $i$ 行的第 $j$ 个方格的次数。 ### 输出格式 输出三行,每行三个整数。第 $i$ 行的第 $j$ 个方格的数表示该方格的最终数值( $0$ 或 $1$)。

加入题单

算法标签: