-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent.java
More file actions
38 lines (33 loc) · 1.04 KB
/
agent.java
File metadata and controls
38 lines (33 loc) · 1.04 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
import java.util.Scanner;
public class agent {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[][] arr = new char[3][3];
String a[] = new String[3];
int n = 3;
for (int i = 0; i < n; i++) {
a[i] = sc.next();
}
for (int j = 0; j < n; j++) {
for (int k = 0; k < n; k++) {
arr[j][k] = a[j].charAt(k);
}
}
// // Input 3x3 matrix, one character per line
// for (int i = 0; i < n; i++) {
// for (int j = 0; j < n; j++) {
// arr[i][j] = sc.next().charAt(0);
// }
// }
// Check symmetry conditions of Super Agent problem
if (arr[0][0] == arr[2][2] &&
arr[0][1] == arr[2][1] &&
arr[0][2] == arr[2][0] &&
arr[1][0] == arr[1][2]) {
System.out.println("YES");
} else {
System.out.println("NO");
}
sc.close();
}
}