Mishakis

SymetricArray

Nov 21st, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         String number = scanner.nextLine();
  10.         Integer N = Integer.parseInt(number);
  11.         for (int i = 0; i < N; i++) {
  12.             String[] arr2 = scanner.nextLine().split(" ");
  13.             boolean isSymetric = true;
  14.             for(int j = 0; j < arr2.length / 2; j++){
  15.                 if (!arr2[j].equals(arr2[arr2.length -1 - j ]) ) {
  16.                     isSymetric =false;
  17.                     break;
  18.                 }
  19.             }
  20.             if(isSymetric){
  21.                 System.out.println("Yes");
  22.             }else{
  23.                 System.out.println("No");
  24.             }
  25.         }
  26.  
  27.  
  28.  
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment