非常垃圾的一段代码。。。

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[][] arr = new int[n][n];
        arr[0][0] = 1;
        for(int i = 0; i<n; i++){
            for(int j = 0; j<n-i; j++){   
                if(j==0){
                    if(i>0){
                         arr[i][j] = arr[i-1][j] + i;
                         System.out.print(arr[i][j]+" ");
                         continue;
                    }else{
                        System.out.print(arr[i][j]+" ");
                        continue;
                    }
                }
                arr[i][j] = arr[i][j-1] + j + 1 +i;
                System.out.print(arr[i][j]+" ");
            }
        System.out.println();
        }
    }
}