Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String firstLine = scanner.nextLine();
- int numberOfLines = Integer.parseInt(firstLine);
- int counter = 1;
- boolean isSymmetric = false;
- for (int i = 0; i < numberOfLines; i++) {
- String input = scanner.nextLine();
- String[] line = input.split(" ");
- Integer[] array = new Integer[line.length];
- for (int j = 0; j < line.length; j++) {
- array[j] = Integer.parseInt(line[j]);
- }
- counter = 1;
- for (int j = 0; j < line.length / 2; j++) {
- if (array[j].equals(array[array.length - counter])) {
- counter++;
- isSymmetric = true;
- } else {
- isSymmetric = false;
- break;
- }
- }
- System.out.println();
- if (isSymmetric) {
- System.out.println("Yes");
- } else System.out.println("No");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement