Day 4 initial commit

Signed-off-by: Eoghan Conlon <git@eoghanconlon.ie>
This commit is contained in:
Eoghan Conlon 2024-12-09 15:22:49 +00:00
parent 35d93ed435
commit ac513e807a
2 changed files with 35 additions and 1 deletions

27
src/Day04.java Normal file
View file

@ -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);
}
}
}
}

View file

@ -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);
}
}