Skip to content

Instantly share code, notes, and snippets.

@pteacher
Created October 18, 2017 13:18
Show Gist options
  • Save pteacher/714d06afa00cf906414a13c8288f2751 to your computer and use it in GitHub Desktop.
Save pteacher/714d06afa00cf906414a13c8288f2751 to your computer and use it in GitHub Desktop.
2nd task from 1.11
package com.company;
import java.util.Scanner;
public class Main {
static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
int n = in.nextInt();
int[][] a = new int[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
a[i][j] = in.nextInt();
}
}
int k = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j] == a[j][i]) {
k++;
}
}
}
System.out.println((k == n*n) ? "yes" : "no");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment