Task: | Ruudukko |
Sender: | Affax |
Submission time: | 2019-09-30 15:47:29 +0300 |
Language: | Java |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.13 s | details |
#2 | ACCEPTED | 0.12 s | details |
#3 | WRONG ANSWER | 0.12 s | details |
#4 | WRONG ANSWER | 0.13 s | details |
#5 | WRONG ANSWER | 0.14 s | details |
#6 | WRONG ANSWER | 0.15 s | details |
Code
import java.util.Scanner; import java.util.logging.Logger; public class Tehtava1 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int input = scanner.nextInt(); 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) { System.out.println(msg); } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 2
Verdict: ACCEPTED
input |
---|
2 |
correct output |
---|
1 2 2 1 |
user output |
---|
1 2 2 1 |
Test 3
Verdict: WRONG ANSWER
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 |
---|
1 5 4 3 2 2 1 5 4 3 3 2 1 5 4 4 3 2 1 5 5 4 3 2 1 |
Test 4
Verdict: WRONG ANSWER
input |
---|
42 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 42 41 40 39 38 37 36 35 34 3... Truncated |
Test 5
Verdict: WRONG ANSWER
input |
---|
99 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 99 98 97 96 95 94 93 92 91 9... Truncated |
Test 6
Verdict: WRONG ANSWER
input |
---|
100 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 100 99 98 97 96 95 94 93 92 ... Truncated |