|
|
back to boardWA #4-Java import java.util.Scanner; public class KVoprosuOSporte { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[][] a = new int[n][n]; int k = 0; int[] b = new int[n * n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { a[i][j] = in.nextInt(); b[k] = a[i][j]; k++; } } for (int i = 0; i < b.length - 1; i++) { for (int j = i + 1; j < b.length; j++) { if (b[i] > b[j]) { int tmp = b[i]; b[i] = b[j]; b[j] = tmp; } } } for (int i = 0; i < b.length; i++) { System.out.println(b[i]); } } } |
|
|