0
点赞
收藏
分享

微信扫一扫

【蓝桥杯】旋转

westfallon 2022-03-24 阅读 93

时间限制: 1.0s
内存限制: 512.0MB
本题总分:15 分

 

package 省题2019;

import java.util.Scanner;

public class 旋转 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
          Scanner sc = new Scanner(System.in);
          
          int row = sc.nextInt(); //获取行数
          int col = sc.nextInt(); //获取列数
          
          //构建一个二维数组
          int[][] arr = new int[row][col];
          
          //接收数据
          for(int i = 0; i < row; i++) {
        	  for(int j = 0; j < col; j++) {
        		  arr[i][j] = sc.nextInt();
        	  }
          }
          
          /**
           * 输出的第一个数字下标为【row-1】【0】
           * 第二个数字的下标为【row - 2】【0】
           */
          for(int a = 0; a < col ; a++) {
        	  for(int b = row -1; b >= 0; b--) {
        		  System.out.print(arr[b][a]+" ");
        	  }
        	  System.out.println();
          }
          
          
	}

}
举报

相关推荐

蓝桥杯,,,,,,

【蓝桥杯】

蓝桥杯练习

蓝桥杯自用

蓝桥杯模板

蓝桥杯——礼物

直线(蓝桥杯)

0 条评论