add solution for hw3:3637 & tests in runner
This commit is contained in:
@@ -30,15 +30,32 @@ public class ReverseMaxC {
|
||||
lines[linesCount++] = line;
|
||||
}
|
||||
|
||||
PrintWriter out = getPrintWriter(linesCount, lines);
|
||||
out.flush();
|
||||
}
|
||||
|
||||
private static PrintWriter getPrintWriter(int linesCount, int[][] lines) {
|
||||
PrintWriter out = new PrintWriter(System.out);
|
||||
for (int i = linesCount - 1; i >= 0; i--) {
|
||||
|
||||
for (int i = 0; i < linesCount; i++) {
|
||||
int[] line = lines[i];
|
||||
for (int j = line.length - 1; j >= 0; j--) {
|
||||
if (j < line.length - 1) out.print(" ");
|
||||
out.print(line[j]);
|
||||
|
||||
for (int j = 0; j < line.length; j++) {
|
||||
|
||||
if (j > 0) out.print(" ");
|
||||
|
||||
int maxRow = lines[i][j];
|
||||
|
||||
for (int k = i + 1; k < linesCount; k++) {
|
||||
if (lines[k].length > j && lines[k][j] > maxRow) {
|
||||
maxRow = lines[k][j];
|
||||
}
|
||||
}
|
||||
|
||||
out.print(maxRow);
|
||||
}
|
||||
out.println();
|
||||
}
|
||||
out.flush();
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user