第三题。提示我哪里错了呗

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

public class Mainnn {
    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, "UTF-8");

        int kuan;
        int gao;
        kuan = in.nextInt();
        gao = in.nextInt();
        int[][] a = new int[kuan][gao];
        for (int i = 0; i <kuan; i++) {
            for (int j = a[gao].length-2; j >-1; j--) {
                a[i][j] = in.nextInt();
            }
        }

        for (int m = 0; m < gao; m++) {
            for (int n =0; n<kuan-2; n++) {
                if (a[m][n] == 0) {
                    ps.print(" ");
                } else if (a[m][n] == 1) {
                    ps.print("*");

                }

            }
            ps.println();
        }

    }
}

1 条评论

  • 1