From f79852dd93b8e1b796d5df55141af116dcd68619 Mon Sep 17 00:00:00 2001 From: kirreen Date: Fri, 8 Dec 2023 14:27:55 +0100 Subject: [PATCH] removed some includes --- day6/day6a.c | 26 ++++++++++++++------------ day6/run | Bin 15480 -> 15480 bytes 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/day6/day6a.c b/day6/day6a.c index e5daaa3..2d96575 100644 --- a/day6/day6a.c +++ b/day6/day6a.c @@ -1,27 +1,29 @@ -#include #include -#include -#include -#include -#include -#define RACES 4 +#define RACES 1 int main() { // unsigned long int times[RACES] = {7, 15, 30}; // unsigned long int distances[RACES] = {9, 40, 200}; - unsigned long int times[RACES] = {44, 80, 65, 72}; - unsigned long int distances[RACES] = {208, 1581, 1050, 1102}; + // unsigned long int times[RACES] = {44, 80, 65, 72}; + // unsigned long int distances[RACES] = {208, 1581, 1050, 1102}; + + // part c - set RACES to 1 + // unsigned long int times = 71530; + // unsigned long int distances = 940200; + unsigned long int times = 44806572; + unsigned long int distances = 208158110501102; + unsigned long int numWins[RACES] = {0}; unsigned long int range = 0; unsigned long int sum = 1; for (unsigned long int i = 0; i < RACES; i++) { - for (unsigned long int j = 0; j < times[i]; j++) { - range = j * (times[i] - j); - printf("%d = %d * (%d - %d)\n", range, j, times[i], j); - if (range > distances[i]) numWins[i]++; + for (unsigned long int j = 0; j < times; j++) { + range = j * (times - j); + // printf("%ul = %ul * (%ul - %ul)\n", range, j, times, j); + if (range > distances) numWins[i]++; } if (numWins[i] > 0) sum *= numWins[i]; } diff --git a/day6/run b/day6/run index 4572253208f08b651a2b2cee67c1abd08cf74c17..d72d39742812ce20b5361794e8497d51f3a803f7 100755 GIT binary patch delta 591 zcmexS@uOk`2P0P`69X7TGEEj@)Z^R&;W2F4?8&IlC@7!+;lt_4olMsS8KH`p7#I(* zfY_4@nZ-qXB6*&B7QR;vZ*NOV6J@-ubZ6PK&2yMH@zyuLaY*s#W>M7uD)s1e{b6{( zwe+X#q3!vBw4@=hv#bQ9#36E}@eevS&|NkcsGcfRe=9l~B(fo$PqxlHO;mrpX_<1KUV4E>XfyJ=6 zG}lT&HH8ag5Ti7+wF;1C24aB^|Nln-X$K(f0HiHH{{Pn*u8i?n@ zE&!rHx=et0!{kNeH}TdtzL@}2mEzIOqN)L8cyzk{ zFg)OK+;xHuh8{h(97g)MB@Hb_G9RxS&f=BCt5;>SYpt1`d-BUrngSZpy zQIBS@az>Bly&&%}^S6mZ3<0YHJJy$%fd}E*^uLpJg~ZwH{{H`e^6+LKAs*gI3M`JQ zDGIg