-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbaekjoon_1802.java
More file actions
30 lines (27 loc) · 1010 Bytes
/
baekjoon_1802.java
File metadata and controls
30 lines (27 loc) · 1010 Bytes
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
import java.io.*;
public class baekjoon_1802 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
for (int i = 0; i < N; i++) {
boolean isCorrect = true;
String str = br.readLine();
int len = str.length();
int[] input = new int[len];
for (int j = 0; j < len; j++) {
input[j] = Integer.parseInt(String.valueOf(str.charAt(j)));
}
while (isCorrect && len > 1) {
for (int j = 0; j < len / 2; j++) {
if (input[j] + input[len - 1 - j] != 1) {
isCorrect = false;
break;
}
}
len /= 2;
System.out.println("len = " + len);
}
System.out.println(isCorrect ? "YES" : "NO");
}
}
}