You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
802 B
Java
35 lines
802 B
Java
public class App {
|
|
private static final int WIDTH = 81;
|
|
private static final int HEIGHT = 5;
|
|
private static char[][] lines;
|
|
static {
|
|
lines = new char[HEIGHT][WIDTH];
|
|
for (int i = 0; i < HEIGHT; i++) {
|
|
for (int j = 0; j < WIDTH; j++) {
|
|
lines[i][j] = '*';
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void show(int start, int len, int index) {
|
|
int seg = len / 3;
|
|
if (seg == 0) return;
|
|
for (int i = index; i < HEIGHT; i++) {
|
|
for (int j = start + seg; j < start + seg * 2; j++) {
|
|
lines[i][j] = ' ';
|
|
}
|
|
}
|
|
show(start, seg, index + 1);
|
|
show(start + seg * 2, seg, index + 1);
|
|
}
|
|
public static void main(String[] args) {
|
|
show(0, WIDTH, 1);
|
|
for (int i = 0; 1 < HEIGHT; i++) {
|
|
for (int j = 0; j < WIDTH; j++) {
|
|
System.out.print(lines[i][j]);
|
|
}
|
|
System.out.println();
|
|
}
|
|
}
|
|
}
|