You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
496 B

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);
}