diff --git a/src/Day04.java b/src/Day04.java new file mode 100644 index 0000000..41f23db --- /dev/null +++ b/src/Day04.java @@ -0,0 +1,27 @@ +import java.io.IOException; + +public class Day04 extends Input{ + private Input input; + + private char[][] sample_in; + private char[][] actual_in; + + public Day04() throws IOException { + this.input = new Input(); + this.input.init("in/Day04"); + this.sample_in = new char[this.input.getSample_input().size()][this.input.getSample_input().getFirst().length()]; + for(int i = 0; i < this.sample_in.length; i += 1){ + String s = this.input.getSample_input().get(i).strip(); + for(int j = 0; j < s.length(); j += 1){ + this.sample_in[i][j] = s.charAt(j); + } + } + this.actual_in = new char[this.input.getInput().size()][this.input.getInput().getFirst().length()]; + for(int i = 0; i < this.actual_in.length; i += 1){ + String s = this.input.getInput().get(i).strip(); + for(int j = 0; j < s.length(); j += 1){ + this.actual_in[i][j] = s.charAt(j); + } + } + } +} diff --git a/src/Main.java b/src/Main.java index 1d8c4fb..6e7ae51 100644 --- a/src/Main.java +++ b/src/Main.java @@ -82,6 +82,13 @@ public class Main { System.out.printf("Day 3 part 1 (sample): %d (%dms)\n", day03_p1_sample, day03_p1_sample_t); System.out.printf("Day 3 part 1 : %d (%dms)\n", day03_p1, day03_p1_t); System.out.printf("Day 3 part 2 (sample): %d (%dms)\n", day03_p2_sample, day03_p2_sample_t); - System.out.printf("Day 3 part 2: %d (%dms)", day03_p2, day03_p2_t); + System.out.printf("Day 3 part 2: %d (%dms)\n", day03_p2, day03_p2_t); + + System.out.println("\nDay 4:"); + start = System.currentTimeMillis(); + Day04 day04 = new Day04(); + long day04_init = System.currentTimeMillis() - start; + + System.out.printf("Day 4 init took %dms", day04_init); } }