public class Solution {
public static int[][] multiArray;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int input = scanner.nextInt();
if (input > 0) {
int times = input;
multiArray = new int[input][];
for (int i = 0; i < input; i++) {
multiArray[i] = new int[i + 1];
}
while (times-- > 0 && scanner.hasNext()) {
int second = scanner.nextInt();
if (second > 0) {
for (int i = 0; i < multiArray.length; i++) {
for (int j = 0; j < multiArray[i].length; j++) {
multiArray[i] = new int[i+1];
}
}
}
}
}
for (int i = 0; i < multiArray.length; i++) {
for (int j = 0; j < multiArray[i].length; j++) {
System.out.print(multiArray[i][j]);
}
System.out.println();
}
}
}
Alex Tor
Level 31
My solution considered correct and it's solved now, but I don't think so.
Resolved
Comments (5)
- Popular
- New
- Old
You must be signed in to leave a comment
Alex Tor Software Developer
24 July 2022, 09:12
Guys, my point is, that the code meets all requirements criteria, hence it's passed validation, but I believe the solution wasn't correct, I need a second opinion, please check out my code.
Thank you in advance!
P-S: I don't want to resolve it accidentally, and I want to make sure that's not the case.
0
Alex Tor Software Developer
24 July 2022, 09:08
Conditions:
0
Thomas
24 July 2022, 16:10useful
+2
Thomas
24 July 2022, 16:13solution
I'd code it that way and I believe CG wants to express, that they just test with positive values here. So I'd omit these tests and try to validate without
+3
Alex Tor Software Developer
25 July 2022, 07:08
Now it's clear, thanks!
+2