Browse Source

040 ok

master
Coin de Gamma 11 months ago
parent
commit
6c0c14c6a5
  1. 23
      040/main.rs

23
040/main.rs

@ -0,0 +1,23 @@
use std::str::FromStr;
fn ts(k: usize, s: &String) -> u32 {
u32::from_str(s.chars().nth(k).unwrap().to_string().as_str()).unwrap()
}
fn main() {
let mut res = String::from("0");
let mut k = 1usize;
while res.len() < 1000001 {
res.push_str(k.to_string().as_str());
k += 1;
}
println!("{}", ts(9, &res));
let mut prod = 1;
let mut i = 1;
while i <= 1000000 {
prod *= ts(i, &res);
i *= 10;
}
println!("{}", prod);
}
Loading…
Cancel
Save