This commit is contained in:
2025-12-28 21:05:06 +08:00
parent 5d09b15326
commit bdaedc135e
46 changed files with 485 additions and 38 deletions
@@ -0,0 +1,17 @@
import java.util.*;
public class P2969 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
for (int i = 0; i < n; i++) {
int stars = i <= n / 2 ? (2 * i + 1) : (2 * (n - i - 1) + 1);
int spaces = (n - stars) / 2;
StringBuilder row = new StringBuilder();
for (int s = 0; s < spaces; s++) row.append(' ');
for (int k = 0; k < stars; k++) row.append('*');
System.out.println(row.toString());
}
in.close();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB