update tests
All checks were successful
Reverse Tests / test (push) Successful in 6s
Sum Tests / test (push) Successful in 7s

This commit is contained in:
2026-01-30 16:36:08 +05:00
parent 8414aeb924
commit 04af91b4a7
7 changed files with 186 additions and 41 deletions

View File

@@ -0,0 +1,52 @@
package reverse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
public class ReverseRotate {
public static void main(String[] args) throws IOException {
FastScanner sc = new FastScanner();
int[][] lines = new int[8][];
int linesCount = 0;
int maxCols = 0;
while (sc.hasNextLine()) {
int[] line = new int[8];
int count = 0;
while (sc.hasNextInt()) {
if (count >= line.length) {
line = Arrays.copyOf(line, line.length * 2);
}
line[count++] = sc.nextInt();
}
sc.nextLine();
line = Arrays.copyOf(line, count);
if (linesCount >= lines.length) {
lines = Arrays.copyOf(lines, lines.length * 2);
}
lines[linesCount++] = line;
if (count > maxCols) {
maxCols = count;
}
}
PrintWriter out = new PrintWriter(System.out);
for (int j = 0; j < maxCols; j++) {
for (int i = linesCount - 1; i >= 0; i--) {
if (lines[i].length > j) {
out.print(lines[i][j] + " ");
}
}
out.println();
}
out.flush();
}
}