题意:给定一个矩阵,其中元素为 0或者1
花最少次数 改变其中的0 到1, 使得每个元素上下左右的数字之和为 偶数
方法:枚举第一行2^n 种情况,最后判断最后一行是否满足
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <cstring>
#include <queue>
using namespace std;
///宏定义
const int INF = 20000000;
const int maxn = 20;
///全局变量 和 函数
//
int T;
int board[maxn][maxn];
int board1[maxn][maxn];
int n;
int cnt;
bool test()
{
int i, j;
for (i = 1; i <= n - 1; i++)
{
for (j = 1; j <= n; j++)
{
//推导下一行的状态