解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class _1097 { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int count=1; int n = scanner.nextInt(); int[][] num=new int[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j <= i ; j++) { num[i-j][j]=count; count++; } } for (int i = 0; i < n; i++) { for (int j = 0; j < n-i; j++) { if (j==n-i-1){ System.out.println(num[i][j]); break; } System.out.print(num[i][j]+" "); } } } }
0.0分
0 人评分