update
All checks were successful
Markup Tests / test (push) Successful in 8s
Markdown to Html Tests / test (push) Successful in 17s

This commit is contained in:
2026-02-17 09:32:08 +03:00
commit 2f05f238e9
109 changed files with 9369 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
package reverse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
/**
* @author Nikita Doschennikov (me@fymio.us)
*/
public class ReverseSum {
public static void main(String[] args) throws IOException {
FastScanner sc = new FastScanner();
int[][] lines = new int[8][];
int linesCount = 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;
}
printResult(linesCount, lines);
}
private static void printResult(int linesCount, int[][] lines) {
PrintWriter out = new PrintWriter(System.out);
for (int i = 0; i < linesCount; i++) {
int[] line = lines[i];
for (int j = 0; j < line.length; j++) {
if (j > 0) out.print(" ");
int sum = 0;
for (int m = 0; m < lines[i].length; m++) {
sum += lines[i][m];
}
for (int k = 0; k < linesCount; k++) {
if (k != i && lines[k].length > j) {
sum += lines[k][j];
}
}
out.print(sum);
}
out.println();
}
out.flush();
}
}