mirror of
https://github.com/Rhelvetican/aoc2024.git
synced 2025-01-10 20:31:36 +00:00
day 3.1
This commit is contained in:
parent
b250c12230
commit
7e01b4fb9c
1 changed files with 3 additions and 3 deletions
|
@ -10,9 +10,6 @@ static MUL: LazyLock<Regex> =
|
||||||
static COND_MUL: LazyLock<Regex> =
|
static COND_MUL: LazyLock<Regex> =
|
||||||
LazyLock::new(|| Regex::new(r"(mul\([0-9]{1,3},[0-9]{1,3}\))|(do\(\))|(don't\(\))").unwrap());
|
LazyLock::new(|| Regex::new(r"(mul\([0-9]{1,3},[0-9]{1,3}\))|(do\(\))|(don't\(\))").unwrap());
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
|
||||||
pub struct AocDayThreeSolution;
|
|
||||||
|
|
||||||
fn as_mul(s: &str) -> u64 {
|
fn as_mul(s: &str) -> u64 {
|
||||||
let (a, b) = s[4..(s.len() - 1)]
|
let (a, b) = s[4..(s.len() - 1)]
|
||||||
.split_once(',')
|
.split_once(',')
|
||||||
|
@ -22,6 +19,9 @@ fn as_mul(s: &str) -> u64 {
|
||||||
a * b
|
a * b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
pub struct AocDayThreeSolution;
|
||||||
|
|
||||||
impl AocSolution for AocDayThreeSolution {
|
impl AocSolution for AocDayThreeSolution {
|
||||||
type Output = u64;
|
type Output = u64;
|
||||||
const INPUT: &str = include_str!("../../input/day3.txt");
|
const INPUT: &str = include_str!("../../input/day3.txt");
|
||||||
|
|
Loading…
Reference in a new issue