init
This commit is contained in:
6
problems/p15/Cargo.toml
Normal file
6
problems/p15/Cargo.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "p15"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
14
problems/p15/src/main.rs
Normal file
14
problems/p15/src/main.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
fn path(n: u16) {
|
||||
let mut map: Vec<Vec<u64>> = vec![vec![1; n as usize]; n as usize];
|
||||
|
||||
for i in 1..n as usize {
|
||||
for j in 1..n as usize {
|
||||
map[i][j] = map[i - 1][j] + map[i][j - 1];
|
||||
}
|
||||
}
|
||||
println!("{}", map[(n - 1) as usize][(n - 1) as usize]);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
path(21);
|
||||
}
|
||||
Reference in New Issue
Block a user