1
0
This commit is contained in:
2026-02-04 11:15:03 +08:00
commit 8b20a5dd21
125 changed files with 4177 additions and 0 deletions

7
problems/p20/Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "p20"
version = "0.1.0"
edition = "2024"
[dependencies]
num-bigint = "0.4.6"

17
problems/p20/src/main.rs Normal file
View File

@@ -0,0 +1,17 @@
use num_bigint::BigUint;
fn main() {
let mut fact = BigUint::from(1u32);
for i in 1..=100 {
fact *= BigUint::from(i as u32);
}
let mut sum = BigUint::from(0u32);
let ten = BigUint::from(10u32);
let zero = BigUint::from(0u32);
while fact != zero {
sum += &fact % &ten;
fact /= &ten;
}
println!("{sum}");
}