解题思路:
注意事项:
参考代码:
import java.util.*;
public class Text_1115 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while (n != 0) {
int a = sc.nextInt();
int b = sc.nextInt();
for (int j = 1; j <= a; j++) {
for (int k = 1; k <= a; k++) {
if (j == k || j + k == a + 1) {
System.out.print("X");
} else {
System.out.print(" ");
}
}
System.out.println();
}
for (int i = 2; i <= b; i++) {
for (int j = 2; j <= a; j++) {
for (int k = 1; k <= a; k++) {
if (j == k || j + k == a + 1) {
System.out.print("X");
} else {
System.out.print(" ");
}
}
System.out.println();
}
}
System.out.println();
n--;
}
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.5 (C++代码)浏览:487 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:642 |
最小公倍数 (C语言代码)浏览:1107 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:388 |
1009题解浏览:802 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:590 |
输入输出格式练习 (C语言代码)浏览:773 |
找出最长的字符串来 (C语言代码)浏览:1840 |
简单的a+b (C语言代码)浏览:491 |
1052题解(链表操作)浏览:782 |