mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Avoid unnecessary floor
This commit is contained in:
@@ -55,7 +55,7 @@ fn ways(time: u64, distance: u64) -> u64 {
|
|||||||
0
|
0
|
||||||
} else {
|
} else {
|
||||||
// Note: can leave out quite a bit of the quadratic formula because things cancel out nicely
|
// Note: can leave out quite a bit of the quadratic formula because things cancel out nicely
|
||||||
let solution = ((b - d.sqrt()) / 2.0 + 1.0).floor() as u64;
|
let solution = ((b - d.sqrt()) / 2.0 + 1.0) as u64;
|
||||||
let half = time / 2;
|
let half = time / 2;
|
||||||
let make_it = half - solution + 1;
|
let make_it = half - solution + 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user