In the city of Ultima Thule job applicants are often offered an IQ test.

The test is as follows: the person gets a piece of squared paper with a 4 × 4 square painted on it. Some of the square's cells are painted black and others are painted white. Your task is to repaint at most one cell the other color so that the picture has a 2 × 2 square, completely consisting of cells of the same color. If the initial picture already has such a square, the person should just say so and the test will be completed.

Your task is to write a program that determines whether it is possible to pass the test. You cannot pass the test if either repainting any cell or no action doesn't result in a 2 × 2 square, consisting of cells of the same color.

Input

Four lines contain four characters each: the j-th character of the i-th line equals "." if the cell in the i-th row and the j-th column of the square is painted white, and "#", if the cell is black.

Output

Print "YES" (without the quotes), if the test can be passed and "NO" (without the quotes) otherwise.

Examples
input
####
.#..
####
....
output
YES
input
####
....
####
....
output
NO
Note

In the first test sample it is enough to repaint the first cell in the second row. After such repainting the required 2 × 2 square is on the intersection of the 1-st and 2-nd row with the 1-st and 2-nd column.

题解:模拟,枚举看是否有一个2*2矩形有3个字符相等

 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll gcd(ll a,ll b){
return b?gcd(b,a%b):a;
}
const int N=;
const int mod=1e9+;
char a[][];
bool flag=;
int main()
{
std::ios::sync_with_stdio(false);
for (int i=;i<=;i++) scanf("%s",a[i]+);
for (int i=;i<;i++){
for (int j=;j<;j++){
if(a[i][j]==a[i][j+]&&a[i][j]==a[i+][j]) flag=;
if(a[i][j]==a[i][j+]&&a[i][j]==a[i+][j+]) flag=;
if(a[i][j]==a[i+][j]&&a[i][j]==a[i+][j+]) flag=;
if(a[i+][j]==a[i][j+]&&a[i+][j]==a[i+][j+]) flag=;
}
}
if (flag) printf("YES\n");
else printf("NO\n");
return ;
}

Codeforce 287A - IQ Test (模拟)的更多相关文章

  1. Codeforce#354_B_Pyramid of Glasses(模拟)

    题目连接:http://codeforces.com/contest/676/problem/B 题意:给你一个N层的杯子堆成的金字塔,倒k个杯子的酒,问倒完后有多少个杯子的酒是满的 题解:由于数据不 ...

  2. 用 IQ分布模拟图来测试浏览器的性能

    今天天气太凉快,跟这个日历上属于夏天的那一页显得格格不入!就连我我床下那台废弃的ThinkPad,居然也十分透凉气,那外壳连我的体温高都没有,于是,我就开始想一个方法,让我那个废弃的电脑发热,顺便用它 ...

  3. Codeforce 25A - IQ test (唯一奇偶)

    Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of th ...

  4. Codeforces Round #176 (Div. 1 + Div. 2)

    A. IQ Test 模拟. B. Pipeline 贪心. C. Lucky Permutation 每4个数构成一个循环. 当n为偶数时,n=4k有解:当n为奇数时,n=4k+1有解. D. Sh ...

  5. Codeforce 294A - Shaass and Oskols (模拟)

    Shaass has decided to hunt some birds. There are n horizontal electricity wires aligned parallel to ...

  6. CodeForce 7 B - Memory Manager(模拟)

    题目大意:给你一段内存,要你进行如下的三个操作. 1.分配内存  alloc   X ,分配连续一段长度为X的内存. 如果内存不够应该输出NULL,如果内存够就给这段内存标记一个编号. 2.擦除编号为 ...

  7. CodeForce 439C Devu and Partitioning of the Array(模拟)

     Devu and Partitioning of the Array time limit per test 1 second memory limit per test 256 megabytes ...

  8. Kilani and the Game-吉拉尼的游戏 CodeForce#1105d 模拟 搜索

    题目链接:Kilani and the Game 题目原文 Kilani is playing a game with his friends. This game can be represente ...

  9. 格子游戏Grid game CodeForce#1104C 模拟

    题目链接:Grid game 题目原文 You are given a 4x4 grid. You play a game — there is a sequence of tiles, each o ...

随机推荐

  1. MySQL分支Percona

    MySQL分支Percona 转载自:http://www.cnblogs.com/cevin/archive/2012/05/12/2496859.html 官方网站:http://www.perc ...

  2. 小睿开始呼叫用户,然后FS怎么跟用户交互的整个流程原理

    学习从小睿开始呼叫用户,然后FS怎么跟用户交互的整个流程原理;     1.小睿向欣方新发起呼叫请求;     2.欣方新可以通过线路发起SIP协议请求,来呼叫用户;     3.当用户接通后,将建立 ...

  3. vue-自定义pc端软键盘

    <template> <div> <el-input v-model="money" type="textarea" placeh ...

  4. PHP策略模式1

    [IUser.php] <?php /** * 策略模式 * 将一组特定的行为和算法封装成类,用来适应某些特定的上下文环境,实现从硬编码到解耦 * 应用举例:电商系统针对不同性别跳转到不同的商品 ...

  5. Spark Mllib之分层抽样

    Spark中组件Mllib的学习之基础概念篇 1.解释 分层抽样的概念就不讲了,具体的操作: RDD有个操作可以直接进行抽样:sampleByKey和sample等,这里主要介绍这两个 (1)将字符串 ...

  6. MySQL数据库之part2

    一.索引原理与慢查询优化 一.介绍 1.为何需要有索引 一般的应用系统,读写比例是10:1左右,而且插入操作和一般的更新操作很少出现性能问题.在生产环境中,我们遇到最多的.也是最容易出问题的还是一些负 ...

  7. DLNg序列模型第二周NLP与词嵌入

    1.使用词嵌入 给了一个命名实体识别的例子,如果两句分别是“orange farmer”和“apple farmer”,由于两种都是比较常见的,那么可以判断主语为人名. 但是如果是榴莲种植员可能就无法 ...

  8. C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作,无法为请求的 Configuration 对象创建配置文件。

    应用程序配置文件,对于asp.net是 web.config,对于WINFORM程序是 App.Config(ExeName.exe.config). 配置文件,对于程序本身来说,就是基础和依据,其本 ...

  9. Groovy动态解析

    A:前面需要说些什么吗? B:不需要吗? A:需要吗? 解析方式一:通过指定的paths来初始化GroovyScriptEngine //通过指定的paths来初始化GroovyScriptEngin ...

  10. jmeter压测之 监控--nmon

    压测方法整理: 1.     写jmx脚本,整理csv数据文件: 2.     部署测试环境,把jmx和csv放在压测机,把监控脚本nmon放被压测机: 3.     安装nmon: a.     w ...