请大佬帮帮解答,40分,全是re
  • 板块B2083 画矩形
  • 楼主Y13113834
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/11/22 17:13
  • 上次更新2023/11/22 19:40:06
查看原帖
请大佬帮帮解答,40分,全是re
1157131
Y13113834楼主2023/11/22 17:13
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int gao = sc.nextInt();
       int kuan = sc.nextInt();
       char fu = sc.next().charAt(0);
       int a = sc.nextInt();
       if (a==0){

               for (int j = 0; j < gao; j++) {
                   if (j==0||j==gao-1){
                       for (int k = 0; k < kuan; k++) {
                           System.out.print(fu);
                       }
                       System.out.println("");
                   }else {
                       System.out.print(fu);
                       for (int k = 0; k < kuan-2; k++) {
                           System.out.print(" ");
                       }
                       System.out.print(fu);
                       System.out.println("");

                   }

           }
       }else {
           for (int i = 0; i < gao; i++) {
               for (int j = 0; j < kuan; j++) {
                   System.out.print(fu);
               }
               System.out.println("");
           }
       }
    }
}
2023/11/22 17:13
加载中...