This commit is contained in:
timeshifter
2025-03-20 10:52:24 +01:00
parent f3bb67ee1e
commit 8a7f61e253
2 changed files with 29 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
[package]
name = "euler40"
version = "0.1.0"
edition = "2024"
[dependencies]
+23
View File
@@ -0,0 +1,23 @@
fn main() {
let mut s = String::new();
let mut i = 0;
loop {
s.push_str(&i.to_string());
i += 1;
if s.len() > 1_000_000 {
break;
}
}
let mut result = 1;
for i in [1, 10, 100, 1_000, 10_000, 100_000, 1_000_000] {
result *= s
.chars()
.nth(i)
.unwrap()
.to_string()
.parse::<usize>()
.unwrap();
}
println!("{result}")
}