diff --git a/storage/zeta/rs/completed/17614.rs b/storage/zeta/rs/completed/17614.rs new file mode 100644 index 0000000..540b100 --- /dev/null +++ b/storage/zeta/rs/completed/17614.rs @@ -0,0 +1,23 @@ +use std::io::stdin; + +fn get_clap(n: i32) -> i32 { + if n <= 2 { + return 0; + } + let str_n = n.to_string(); + let x = str_n + .chars() + .filter(|c| *c == '3' || *c == '6' || *c == '9') + .count(); + + return (x as i32) + get_clap(n - 1); +} + +fn main() { + let mut str_n = String::new(); + stdin().read_line(&mut str_n).expect("err"); + + let n: i32 = str_n.trim().parse::().unwrap(); + + println!("{}", get_clap(n)); +}