-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path287A - IQ Test.java
More file actions
64 lines (63 loc) · 1.75 KB
/
287A - IQ Test.java
File metadata and controls
64 lines (63 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import javax.sound.midi.SysexMessage;
import java.util.Scanner;
public class Solution {
public static void main ( String [] args ){
Scanner s = new Scanner(System.in);
int i=0,j=0;
char[][] matrix = new char[4][4];
for( i = 0 ;i < 4 ; i++){
String ip = s.nextLine();
for( j = 0 ; j < 4 ; j++){
matrix[i][j]= ip.charAt(j);
}
}
boolean ans=false;
for( i = 0; i < 3 ; i++){
int count=0;
for(j=0;j<3;j++){
count=0;
if(matrix[i][j]=='#'){
count+=1;
}
if(matrix[i][j+1]=='#'){
count+=1;
}
if(matrix[i+1][j]=='#'){
count+=1;
}
if(matrix[i+1][j+1]=='#'){
count+=1;
}
if(count>=3){
ans=true;
break;
}
else{
count=0;
if(matrix[i][j]=='.'){
count+=1;
}
if(matrix[i][j+1]=='.'){
count+=1;
}
if(matrix[i+1][j]=='.'){
count+=1;
}
if(matrix[i+1][j+1]=='.'){
count+=1;
}
if(count>=3){
ans=true;
break;
}
}
}
}
if(ans == true){
System.out.println("YES");
}
else {
System.out.println("NO");
}
}
}