Task: | Fraktaali |
Sender: | RoniTuohino |
Submission time: | 2017-10-04 15:38:35 +0300 |
Language: | Java |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
#3 | RUNTIME ERROR | 0 |
#4 | RUNTIME ERROR | 0 |
#5 | RUNTIME ERROR | 0 |
#6 | RUNTIME ERROR | 0 |
#7 | RUNTIME ERROR | 0 |
#8 | RUNTIME ERROR | 0 |
#9 | RUNTIME ERROR | 0 |
#10 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.13 s | 1 | details |
#2 | RUNTIME ERROR | 0.15 s | 2 | details |
#3 | RUNTIME ERROR | 0.14 s | 3 | details |
#4 | RUNTIME ERROR | 0.12 s | 4 | details |
#5 | RUNTIME ERROR | 0.11 s | 5 | details |
#6 | RUNTIME ERROR | 0.13 s | 6 | details |
#7 | RUNTIME ERROR | 0.12 s | 7 | details |
#8 | RUNTIME ERROR | 0.12 s | 8 | details |
#9 | RUNTIME ERROR | 0.11 s | 9 | details |
#10 | RUNTIME ERROR | 0.12 s | 10 | details |
Code
package com.company; import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int f = s.nextInt(); int size = (int)CalculateSize(f); char[][]startFrac = new char[size][size]; for (int x = 0; x < startFrac.length; x++){ //Turn all spaces black '#' for (int y = 0; y < startFrac.length; y++){ startFrac[x][y] = '#'; } } startFrac = BuildFractal(startFrac, size, f); PrintFractal(startFrac); } public static double CalculateSize(double x){ //Calculate the size for the fractal if(x == 1){ x = 1; } else if(x == 2){ x = 2; } else if(x == 3){ x = 4; } else if(x == 4){ x = 8; } else if(x >= 5){ x = Math.pow(2, x-1); } return x; } public static char[][] BuildFractal(char[][] frac, int size, int f){ //Build the final fractal char[][] finalFrac; finalFrac = frac; if(f == 1){ return finalFrac; } finalFrac[1][1] = '.'; //First white piece on the corner if(f == 2){ return finalFrac; } for(int i = 2; i < f; i++){ //Do this loop until fractal is complete //Insert all the corners of the fractal finalFrac = SetTheCorners(finalFrac, (int)CalculateSize(i+1) ,(int)CalculateSize(i)); } return finalFrac; } public static char[][] SetTheCorners(char[][] frac, int size, int pos){ //Set the on the fractal char[][] finalFrac = frac; char[][] copy = new char[pos][pos]; //System.out.println(pos); for(int x = 0; x < pos; x++){ //Copy is now the corner to set for(int y = 0; y < pos; y++){ copy[x][y] = finalFrac[x][y]; } } for(int x = 0; x <= pos - 1; x++){ //Set the first corner on the top right for(int y = pos; y <= size - 1; y++){ if(copy[x][y - pos] == '.'){ finalFrac[x][y] = '.'; } } } for(int x = pos; x <= size - 1; x++){ //Set the second corner on the bottom left for(int y = 0; y <= pos - 1; y++){ if(copy[x - pos][y] == '.'){ finalFrac[x][y] = '.'; } } } for(int x = pos; x <= size - 1; x++){ //Scans the bottom right negative for(int y = pos; y <= size - 1; y++){ //finalFrac[x][y] = '.'; if(copy[x - pos][y - pos] == '#'){ finalFrac[x][y] = '.'; } else if(copy[x - pos][y - pos] == '.'){ finalFrac[x][y] = '#'; } } } return finalFrac; } public static void PrintFractal(char[][] frac){ //Print the fractal for (int x = 0; x < frac.length; x++){ System.out.println(""); for(int y=0; y < frac.length; y++){ System.out.print(frac[x][y]); } } } }
Test details
Test 1
Group: 1
Verdict: RUNTIME ERROR
input |
---|
1 |
correct output |
---|
# |
user output |
---|
(empty) |
Error:
Error: Could not find or load main class Main
Test 2
Group: 2
Verdict: RUNTIME ERROR
input |
---|
2 |
correct output |
---|
## #. |
user output |
---|
(empty) |
Error:
Error: Could not find or load main class Main
Test 3
Group: 3
Verdict: RUNTIME ERROR
input |
---|
3 |
correct output |
---|
#### #.#. ##.. #..# |
user output |
---|
(empty) |
Error:
Error: Could not find or load main class Main
Test 4
Group: 4
Verdict: RUNTIME ERROR
input |
---|
4 |
correct output |
---|
######## #.#.#.#. ##..##.. #..##..# ####.... ... |
user output |
---|
(empty) |
Error:
Error: Could not find or load main class Main
Test 5
Group: 5
Verdict: RUNTIME ERROR
input |
---|
5 |
correct output |
---|
################ #.#.#.#.#.#.#.#. ##..##..##..##.. #..##..##..##..# ####....####.... ... |
user output |
---|
(empty) |
Error:
Error: Could not find or load main class Main
Test 6
Group: 6
Verdict: RUNTIME ERROR
input |
---|
6 |
correct output |
---|
##############################... |
user output |
---|
(empty) |
Error:
Error: Could not find or load main class Main
Test 7
Group: 7
Verdict: RUNTIME ERROR
input |
---|
7 |
correct output |
---|
##############################... |
user output |
---|
(empty) |
Error:
Error: Could not find or load main class Main
Test 8
Group: 8
Verdict: RUNTIME ERROR
input |
---|
8 |
correct output |
---|
##############################... |
user output |
---|
(empty) |
Error:
Error: Could not find or load main class Main
Test 9
Group: 9
Verdict: RUNTIME ERROR
input |
---|
9 |
correct output |
---|
##############################... |
user output |
---|
(empty) |
Error:
Error: Could not find or load main class Main
Test 10
Group: 10
Verdict: RUNTIME ERROR
input |
---|
10 |
correct output |
---|
##############################... |
user output |
---|
(empty) |
Error:
Error: Could not find or load main class Main