Problem 1
This commit is contained in:
parent
75f2a5ce70
commit
2d4cec8392
1 changed files with 9 additions and 2 deletions
11
src/one.rs
11
src/one.rs
|
|
@ -1,10 +1,17 @@
|
||||||
use crate::{GlobalArgs, Problem};
|
use crate::{GlobalArgs, Problem};
|
||||||
|
|
||||||
#[derive(clap::Parser)]
|
#[derive(clap::Parser)]
|
||||||
pub struct Args {}
|
pub struct Args {
|
||||||
|
#[clap(default_value = "1000")]
|
||||||
|
pub until: u64,
|
||||||
|
}
|
||||||
|
|
||||||
impl Problem for Args {
|
impl Problem for Args {
|
||||||
|
// We could derive it mathematically, ... or write a dump loop
|
||||||
fn solve(self, _: GlobalArgs) -> color_eyre::Result<()> {
|
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(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue