解题思路:
暴力
棋盘类题目取反操作:
f[a][b]^=1; 或者f[a][b] = 1 - f[a][b];
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int m = scan.nextInt();
int[][] f = new int[n][n];
for (int i = 0; i < m; i++) {
int x1 = scan.nextInt();
int y1 = scan.nextInt();
int x2 = scan.nextInt();
int y2 = scan.nextInt();
for (int a = x1 - 1; a < x2; a++) {
for (int b = y1 - 1; b < y2; b++) {
f[a][b] ^= 1;
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
System.out.print(f[i][j]);
if ((j + 1) == n)
System.out.println();
}
}
}
}