//暴力
#include <iostream>
#include <algorithm>
#include <string> using namespace std;
const int N = ;
string s1[N], s2[N], s3[N], s4[N];
int a[N][N], b[N][N]; int main()
{
int n;
cin >> n;
for (int i = ; i<n; i++)
cin >> s1[i];
cin.get();
for (int i = ; i<n; i++)
cin >> s2[i];
cin.get();
for (int i = ; i<n; i++)
cin >> s3[i];
cin.get();
for (int i = ; i<n; i++)
cin >> s4[i]; for (int i = ; i<n; i++)
for (int j = ; j < n; j++){
//只有两种方式
a[i][j] = (i + j) % == ? : ;
b[i][j] = (i + j) % ? : ;
}
for (int i = ; i<n; i++)
for (int j = ; j<n; j++)
a[i][j] += , b[i][j] += ; //比较
int ans = 1e9;
int f = ;
for (int i = ; i<n; i++)
for (int j = ; j<n; j++)
f += (s1[i][j] != a[i][j]) + (s2[i][j] != a[i][j]) + (s3[i][j] != b[i][j]) + (s4[i][j] != b[i][j]);
ans = min(ans, f);
f = ;
for (int i = ; i<n; i++)
for (int j = ; j<n; j++)
f += (s1[i][j] != a[i][j]) + (s2[i][j] != b[i][j]) + (s3[i][j] != a[i][j]) + (s4[i][j] != b[i][j]);
ans = min(ans, f);
f = ;
for (int i = ; i<n; i++)
for (int j = ; j<n; j++)
f += (s1[i][j] != a[i][j]) + (s2[i][j] != b[i][j]) + (s3[i][j] != b[i][j]) + (s4[i][j] != a[i][j]);
ans = min(ans, f);
f = ;
for (int i = ; i<n; i++)
for (int j = ; j<n; j++)
f += (s1[i][j] != b[i][j]) + (s2[i][j] != a[i][j]) + (s3[i][j] != a[i][j]) + (s4[i][j] != b[i][j]);
ans = min(ans, f);
f = ;
for (int i = ; i<n; i++)
for (int j = ; j<n; j++)
f += (s1[i][j] != b[i][j]) + (s2[i][j] != a[i][j]) + (s3[i][j] != b[i][j]) + (s4[i][j] != a[i][j]);
ans = min(ans, f);
f = ;
for (int i = ; i<n; i++)
for (int j = ; j<n; j++)
f += (s1[i][j] != b[i][j]) + (s2[i][j] != b[i][j]) + (s3[i][j] != a[i][j]) + (s4[i][j] != a[i][j]);
ans = min(ans, f);
cout<< ans <<endl;
system("pause");
return ;
}

C. Chessboard( Educational Codeforces Round 41 (Rated for Div. 2))的更多相关文章

  1. D. Pair Of Lines( Educational Codeforces Round 41 (Rated for Div. 2))

    #include <vector> #include <iostream> #include <algorithm> using namespace std; ty ...

  2. B. Lecture Sleep( Educational Codeforces Round 41 (Rated for Div. 2))

    前缀后缀和搞一搞,然后枚举一下区间,找出最大值 #include <iostream> #include <algorithm> using namespace std; ; ...

  3. (模拟)关于进制的瞎搞---You Are Given a Decimal String...(Educational Codeforces Round 70 (Rated for Div. 2))

    题目链接:https://codeforc.es/contest/1202/problem/B 题意: 给你一串数,问你插入最少多少数可以使x-y型机器(每次+x或+y的机器,机器每次只取最低位--% ...

  4. Educational Codeforces Round 41 (Rated for Div. 2)(A~D)

    由于之前打过了这场比赛的E题,而后面两道题太难,所以就手速半个多小时A了前4题. 就当练手速吧,不过今天除了C题数组开小了以外都是1A A Tetris 题意的抽象解释可以在Luogu里看一下(话说现 ...

  5. Multidimensional Queries(二进制枚举+线段树+Educational Codeforces Round 56 (Rated for Div. 2))

    题目链接: https://codeforces.com/contest/1093/problem/G 题目: 题意: 在k维空间中有n个点,每次给你两种操作,一种是将某一个点的坐标改为另一个坐标,一 ...

  6. Educational Codeforces Round 41 (Rated for Div. 2) ABCDEF

    最近打的比较少...就只有这么点题解了. A. Tetris time limit per test 1 second memory limit per test 256 megabytes inpu ...

  7. Educational Codeforces Round 41 (Rated for Div. 2)

    这场没打又亏疯了!!! A - Tetris : 类似俄罗斯方块,模拟一下就好啦. #include<bits/stdc++.h> #define fi first #define se ...

  8. Educational Codeforces Round 41 (Rated for Div. 2) D. Pair Of Lines (几何,随机)

    D. Pair Of Lines time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  9. Educational Codeforces Round 78 (Rated for Div. 2)E(构造,DFS)

    DFS,把和当前结点相连的点全都括在当前结点左右区间里,它们的左端点依次++,然后对这些结点进行DFS,优先对左端点更大的进行DFS,这样它右端点会先括起来,和它同层的结点(后DFS的那些)的区间会把 ...

随机推荐

  1. jzyz集训 0228

    早上考了一波. 出题人是wangyurzee王队长,题目亲民,数据很水(除了第二题).用来做比赛很不错.(尽管我只有第一题A了). 第一题大意是给你n个操作,每个操作是将你手上的数字区间集合与给出的区 ...

  2. Yii的缓存机制之动态缓存

    当整个页面被缓存,但只有小部分区域需要根据不同的条件设置不同的信息.(例如商品的详细页面的缓存中用户名是动态的)这里就需要设置动态缓存. 首先在被缓存的模板中使用renderDynamic进行动态渲染 ...

  3. Python的GIL是什么鬼,多线程性能究竟如何

    前言:博主在刚接触Python的时候时常听到GIL这个词,并且发现这个词经常和Python无法高效的实现多线程划上等号.本着不光要知其然,还要知其所以然的研究态度,博主搜集了各方面的资料,花了一周内几 ...

  4. tkinter.py

    from tkinter import * def hello():print('hello world') win=Tk() win.title('hello tkinter') win.geome ...

  5. poj 2069 Super Star —— 模拟退火

    题目:http://poj.org/problem?id=2069 仍是随机地模拟退火,然而却WA了: 看看网上的题解,都是另一种做法——向距离最远的点靠近: 于是也改成那样,竟然真的A了...感觉这 ...

  6. HDU1074(状态压缩DP)

    Doing Homework Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)To ...

  7. 实用的MVVM:ImageView

    最近在学习WPF,遇到一本入门好书,推荐给大家<Windows Presentation Foundation 4.5 Cookbook> 做项目首先要从MVVM开始,现在把他的Simpl ...

  8. vue 重塑数组之 修改数组指定index的值

    vm.items[indexOfItem] = newValue vue不能检测数组的变动 想要实现可以使用vue的set方法 this.$set(this.items,indexOfItem,new ...

  9. ceph之ceph-client安装

    1.安装ceph-client ceph-deploy install ceph-client 2.创建块设备 [root@mon1 ~]# rbd create test1 --image-form ...

  10. docker容器磁盘

    docker容器磁盘扩容 一.配置文件里更改容器创建时的默认磁盘大小 [root@ip---- ~]# cat /etc/sysconfig/docker-storage DOCKER_STORAGE ...