Coin de Gamma
11 months ago
1 changed files with 23 additions and 0 deletions
@ -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…
Reference in new issue