Task: | Ruudukko |
Sender: | Affax |
Submission time: | 2019-09-30 15:43:08 +0300 |
Language: | Java |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.14 s | details |
#2 | RUNTIME ERROR | 0.14 s | details |
#3 | RUNTIME ERROR | 0.14 s | details |
#4 | RUNTIME ERROR | 0.14 s | details |
#5 | RUNTIME ERROR | 0.14 s | details |
#6 | RUNTIME ERROR | 0.14 s | details |
Code
import java.util.logging.Logger; public class Tehtava1 { private final static Logger LOGGER = Logger.getLogger("Affax"); public static void main(String[] args) { int input = Integer.parseInt(args[0]); int inputM = input - 1; String[][] posses = new String[input][input]; for (int y = 0; y < input; y++) { int left = y; int right = inputM - y; for (int x = 0; x < right; x++) { posses[y + 1 + x][y] = String.valueOf(x + 2); } for (int x = 0; x < left; x++) { posses[y - 1 - x][y] = String.valueOf(input - x); } posses[y][y] = "1"; } StringBuilder realString = new StringBuilder(); for (int y = 0; y < input; y++) { StringBuilder str = new StringBuilder(); for (int x = 0; x < input; x++) { str.append(posses[y][x]).append(' '); } realString.append(sub(str.toString())).append(y == inputM ? "" : "\n"); } log(realString.toString()); } private static String sub(String str) { String string = str; string.substring(0, str.length()); return string; } private static void log(String msg) { LOGGER.info(msg); } }
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
1 |
correct output |
---|
1 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds...
Test 2
Verdict: RUNTIME ERROR
input |
---|
2 |
correct output |
---|
1 2 2 1 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds...
Test 3
Verdict: RUNTIME ERROR
input |
---|
5 |
correct output |
---|
1 2 3 4 5 2 1 4 3 6 3 4 1 2 7 4 3 2 1 8 5 6 7 8 1 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds...
Test 4
Verdict: RUNTIME ERROR
input |
---|
42 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds...
Test 5
Verdict: RUNTIME ERROR
input |
---|
99 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds...
Test 6
Verdict: RUNTIME ERROR
input |
---|
100 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds...