// Codeforces Round #168 (Div. 2) A. Lights Out
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
//Codeforces
public class MainCodeforces1 {
private static MyScanner in;
private static PrintStream out;
public static void main(String[] args) throws IOException {
// helpers for input/output
boolean LOCAL_TEST = false;// change to false before submitting
out = System.out;
if (LOCAL_TEST) {
in = new MyScanner("E:\\zin2.txt");
}
else {
boolean usingFileForIO = false;
if (usingFileForIO) {
// using input.txt and output.txt as I/O
in = new MyScanner("input.txt");
out = new PrintStream("output.txt");
}
else {
in = new MyScanner();
out = System.out;
}
}
solve();
}
private static void solve() throws IOException
{
boolean[][] L = new boolean[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
L[i][j] = true;
}
}
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
int p = in.nextInt();
if (p % 2 == 1) {
L[i][j] = !L[i][j];
for (int k = 0; k < 3; k++) {
if (Math.abs(k - j) == 1)
L[i][k] = !L[i][k];
if (Math.abs(k - i) == 1)
L[k][j] = !L[k][j];
}
}
}
}
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (L[i][j])
out.print("1");
else
out.print("0");
}
if (i < 2)
out.println("");
}
}
// =====================================
static class MyScanner {
Scanner inp = null;
public MyScanner() throws IOException
{
inp = new Scanner(System.in);
}
public MyScanner(String inputFile) throws IOException {
inp = new Scanner(new FileInputStream(inputFile));
}
public int nextInt() throws IOException {
return inp.nextInt();
}
public long nextLong() throws IOException {
return inp.nextLong();
}
public double nextDouble() throws IOException {
return inp.nextDouble();
}
public String nextString() throws IOException {
return inp.next();
}
}
}
No comments:
Post a Comment