Added Day 3 Part 2
This commit is contained in:
parent
afe718b7a6
commit
be2a7fcef3
10
src/main.rs
10
src/main.rs
|
@ -30,9 +30,15 @@ fn main() {
|
|||
let n = grid[0].len();
|
||||
println!("m = {} n = {}", m, n);
|
||||
|
||||
let treecount = calc_trees(&grid, m, n, 3, 1);
|
||||
let a = calc_trees(&grid, m, n, 3, 1);
|
||||
let b = calc_trees(&grid, m, n, 1, 1);
|
||||
let c = calc_trees(&grid, m, n, 5, 1);
|
||||
let d = calc_trees(&grid, m, n, 7, 1);
|
||||
let e = calc_trees(&grid, m, n, 1, 2);
|
||||
|
||||
println!("{}", treecount);
|
||||
println!("{} {} {} {} {}", a, b, c, d, e);
|
||||
|
||||
println!("{}", a * b * c * d * e);
|
||||
}
|
||||
|
||||
fn calc_trees(grid: &[Vec<GridType>], m: usize, n: usize, slope_x: usize, slope_y: usize) -> u32 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user