艺术第二题一直翻转不过来

package first;

import java.util.Scanner;
import java.io.PrintStream;

public class 翻转 {
    public static void main(String[] args) throws java.io.UnsupportedEncodingException {
        PrintStream ps = new PrintStream(System.out, true, "UTF-8");
        Scanner in = new Scanner(System.in);

        int lieshu;
        int hangshu;

        lieshu = in.nextInt();
        hangshu = in.nextInt();

        int [][] a = new int [hangshu][lieshu];

        int i = 0;
        int j = 0;

        for (i=0;i<hangshu;i++){
            for (j=lieshu;j>-1;j--){
                a[i][j]=in.nextInt();
            }
        }

        int m = 0;
        int n = 0;

        for (m=0;m<lieshu;m++){
            for (n=0;n<hangshu;n++){
                if (a[m][n]==0) {
                    ps.print(" ");
                }
                else if(a[m][n]==1){
                    ps.print("*");
                }
            }ps.println();
        }
    }
}

1 条评论

  • @ 2019-05-14 16:54:32

    可以跟大家讨论一下思路。

    在动手写代码之前,想想“水平翻转”究竟是什么意思?像素位置发生了怎样的变化?

  • 1