Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.math.BigInteger;
- import java.util.*;
- import static java.lang.Math.max;
- import static java.lang.Math.min;
- class Pair<A, B> {
- A fst;
- B snd;
- public Pair(A fst, B snd) {
- this.fst = fst;
- this.snd = snd;
- }
- public A getFst() {
- return fst;
- }
- public B getSnd() {
- return snd;
- }
- }
- public class Main {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner sc = new Scanner(System.in);//new File("lis.in"));//System.in);
- System.out.println("Enter values: "); // Не надо
- int n = sc.nextInt();
- int[][] a = new int[n][n];
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++)
- {
- a[i][j] = sc.nextInt();
- }
- }
- for (int k = 1; k <= n; k++)
- {
- for (int r = 0; r < n - k + 1; r++) // количество стартов от 00
- {
- for (int c = 0; c < n - k + 1; c++)
- {
- // (r, c) ----- (r, c + k - 1)
- //
- // (r + k - 1) ----- (r + k - 1, c + k - 1)
- for (int r1 = r; r1 < r + k; r1++)
- {
- for (int c1 = c; c1 < c + k; c1++)
- {
- System.out.print(a[r1][c1]);
- }
- System.out.println();
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment