Wanncry


私信TA

用户名:782956291

访问量:9724

签 名:

RUSH B

等  级
排  名 277
经  验 5561
参赛次数 0
文章发表 53
年  龄 20
在职情况 学生
学  校 湖北生物科技职业学院
专  业

  自我简介:

把把起野牛 3天大地球

解题思路:

注意事项:

参考代码:

Scanner scanner=new Scanner(System.in);

int n=scanner.nextInt();

int a,b;

for (int i = 1; i <=n; i++) {

a=scanner.nextInt();

b=scanner.nextInt();

for (int j = 1; j <=b; j++) {

int num=a-1;

if (b==1||j==b) {

num=a;

}

for (int j1 = 1,x=0; j1 <= b; j1++,x++) {

for (int j2 = 1; j2 <=a; j2++) {

if (j2==j1||j2==a-x) {

   System.out.print("X");

                } else {

                    System.out.print(" ");

                }

}

System.out.println();

}

}

System.out.println();

}


 

0.0分

3 人评分

  评论区

简化留言
2021-01-27 22:56:42
  • «
  • 1
  • »