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 PTable {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
for (int i = 1; i <= n; i++) {
StringBuilder sb = new StringBuilder();
for (int j = 1; j <= n; j++) {
if (j > 1) sb.append(' ');
sb.append(i * j);
}
System.out.println(sb.toString());
}
in.close();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

@@ -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

@@ -0,0 +1,26 @@
import java.util.*;
public class P2984 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
List<Long> prev = new ArrayList<>();
for (int row = 1; row <= n; row++) {
List<Long> cur = new ArrayList<>(row);
long val = 1;
for (int i = 0; i < row; i++) {
if (i == 0) val = 1;
else val = cur.get(i - 1) * (row - i) / i;
cur.add(val);
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < cur.size(); i++) {
if (i > 0) sb.append(' ');
sb.append(cur.get(i));
}
System.out.println(sb.toString());
prev = cur;
}
in.close();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB