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/p76/Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "p76"
version = "0.1.0"
edition = "2024"
[dependencies]
num-bigint = { workspace = true }

24
problems/p76/src/main.rs Normal file
View File

@@ -0,0 +1,24 @@
// 2 -> 1: 1 + 1
// 3 -> 2: 2 + 1, 1 + 1 + 1
// 4 -> 4: 3 + 1, 2 + 2, 2 + 1 + 1, 1 + 1 + 1 + 1
// 5 -> 4: 4 + 1, 3 + 2, 3 + 1 + 1, 2 + 2 + 1,
// n -> x: (n-1) + 1,
use num_bigint::BigUint;
fn split(n: u64) -> BigUint {
let n = n as usize;
let mut dp = vec![BigUint::ZERO; n + 1];
dp[0] = BigUint::from(1u32);
for i in 1..n {
for j in i..=n {
let temp = dp[j - i].clone();
dp[j] += temp;
}
}
dp[n].clone()
}
fn main() {
let result = split(100);
println!("{result}");
}