Created
July 17, 2016 13:46
-
-
Save Jack-Saleem/2dec19580a646acb93f7bf5b465c7fe7 to your computer and use it in GitHub Desktop.
codeforces 287A IQTest program in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class IQTest | |
{ | |
public static void main(String[] args) | |
{ | |
Scanner z=new Scanner(System.in); | |
String[] s=new String[4]; | |
char[][] a=new char[4][4]; | |
for(int i=0;i<4;i++) | |
s[i]=z.nextLine(); | |
for(int i=0;i<4;i++){ | |
for(int j=0;j<4;j++) | |
a[i][j]=s[i].charAt(j); | |
} | |
int k=0; | |
boolean flag=false; | |
for(int i=0;i<3;i++){ | |
for(int j=0;j<3;j++){ | |
k=0; | |
if(a[i][j]!=a[i][j+1]) | |
k++; | |
if(a[i][j]!=a[i+1][j]) | |
k++; | |
if(a[i][j]!=a[i+1][j+1]) | |
k++; | |
if(k<=1 || k==3){ | |
flag=true; | |
break; | |
} | |
} | |
} | |
if(flag) | |
System.out.println("YES"); | |
else | |
System.out.println("NO"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment