Finit les part 1 du jour 2 et 3

Ouin, pas le temps de faire les part 2 😭
This commit is contained in:
Clement Desmidt
2024-12-03 11:20:03 +01:00
parent 7c9d8ae1bd
commit 77cfb5eba7
2 changed files with 60 additions and 0 deletions

8
day_3/part_1.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
$instruction = file_get_contents(__DIR__.'/input.txt');
preg_match_all('/mul\((\d+),(\d+)\)/', $instruction, $muls, PREG_SET_ORDER);
echo array_sum(array_map(static fn($mul) => $mul[1]*$mul[2], $muls));
exit;