Problem 1

This commit is contained in:
Quentin Boyer 2024-11-27 11:57:40 +01:00
parent 75f2a5ce70
commit 2d4cec8392

View file

@ -1,10 +1,17 @@
use crate::{GlobalArgs, Problem};
#[derive(clap::Parser)]
pub struct Args {}
pub struct Args {
#[clap(default_value = "1000")]
pub until: u64,
}
impl Problem for Args {
// We could derive it mathematically, ... or write a dump loop
fn solve(self, _: GlobalArgs) -> color_eyre::Result<()> {
todo!()
let sum: u64 = (0..self.until).filter(|x| x % 3 == 0 || x % 5 == 0).sum();
println!("Sum of 0..{}: {}", self.until, sum);
Ok(())
}
}