-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2023SWEA_1215
More file actions
55 lines (50 loc) · 1.7 KB
/
2023SWEA_1215
File metadata and controls
55 lines (50 loc) · 1.7 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
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw =new BufferedWriter(new OutputStreamWriter(System.out));
char[][] arr;
for(int t=1; t<=10; t++){
int len = Integer.parseInt(br.readLine());
arr=new char[8][8];
for(int i=0; i<8; i++){
StringBuilder sb=new StringBuilder(br.readLine());
for(int j=0; j<8; j++){
arr[i][j] = sb.charAt(j);
}
}
StringBuilder sb2;
int count=0;
//가로 부터
for(int i=0; i<8; i++){
for(int j=0; j<=8-len; j++){
sb2 =new StringBuilder();
for(int k=j; k<len+j; k++){
sb2.append(arr[i][k]);
}
if(sb2.toString().equals(sb2.reverse().toString())){
count++;
}
}
}
//세로
for(int i=0; i<8; i++){
for(int j=0; j<=8-len; j++){
sb2 =new StringBuilder();
for(int k=j; k<len+j; k++){
sb2.append(arr[k][i]);
}
if(sb2.toString().equals(sb2.reverse().toString())){
count++;
}
}
}
bw.write("#"+t+" ");
bw.write(String.valueOf(count));
bw.newLine();
}//test case end
bw.flush();
bw.close();
}
}