Skip to content

Commit

Permalink
day06: Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pedantic79 committed Jan 2, 2024
1 parent 2bbcc38 commit 0243a3f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/day06.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ pub fn generator_p2(input: &str) -> Vec<usize> {
process_input(nom_lines(parse_number))(input)
}

// dist = (x - time) * x
// 0 = x² - time*x - dist
fn ways(time: usize, dist: usize) -> usize {
let pyth = sqrt(time * time - 4 * dist);
let r0 = (time - pyth) / 2;
Expand Down

0 comments on commit 0243a3f

Please sign in to comment.