From 2d2be463d1699e48fbfdd21d36b922c96731a88e Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Thu, 7 Dec 2023 21:52:37 +0100 Subject: [PATCH] Avoid unnecessary floor --- 2023/src/day06.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2023/src/day06.rs b/2023/src/day06.rs index 33c1c2c..d4b5efa 100644 --- a/2023/src/day06.rs +++ b/2023/src/day06.rs @@ -55,7 +55,7 @@ fn ways(time: u64, distance: u64) -> u64 { 0 } else { // 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 make_it = half - solution + 1;