From 9e63affcf6707e27e4324ff2ff82ad9f549c0e6d Mon Sep 17 00:00:00 2001 From: kageru Date: Sun, 15 Dec 2019 09:20:33 +0100 Subject: [PATCH] Optimize D14P2 --- 2019/14/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2019/14/src/main.rs b/2019/14/src/main.rs index dbadb32..9def6c2 100644 --- a/2019/14/src/main.rs +++ b/2019/14/src/main.rs @@ -57,7 +57,7 @@ fn main() { // Not beautiful, but it gets the job done. fn make_all_the_fuel(mut total_ore: usize, limit: usize) -> usize { - let initial_batch_size = 10_000; + let initial_batch_size = 1 << 15; let mut batch_size = initial_batch_size; let mut fuel = 0; while total_ore < limit { @@ -65,7 +65,7 @@ fn make_all_the_fuel(mut total_ore: usize, limit: usize) -> usize { fuel += batch_size; // gib int multiplication with float pls if total_ore > limit - (limit / (initial_batch_size / batch_size)) && batch_size > 1 { - batch_size /= 10; + batch_size /= 2; } } fuel