summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Spragg <adam@spra.gg>2023-01-29 16:19:35 +0000
committerAdam Spragg <adam@spra.gg>2023-01-30 19:07:53 +0000
commit5c8e1d84d998449bb590bce60566594e1c7012da (patch)
tree2e58d6599dc9926d72bda97175673be0d2834eff
parentb43bdf75540c9daab5c94317bf910d0eba3755ab (diff)
Puzzle 19: Make geode product an unsigned long.
Because it can never be negative, and some of the blueprint combinations can cause it to wrap. This gives us one more factor of two breathing room.
-rw-r--r--19.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/19.c b/19.c
index f44f46c..4ea88c2 100644
--- a/19.c
+++ b/19.c
@@ -322,7 +322,7 @@ main(int argc, char ** argv)
int debug = 0, rounds = 24;
char const * build = "exhaustive", * output = "quality";
int quality = 0, i;
- long product = 1;
+ unsigned long product = 1;
regex_t reblueprint;
char buf[BUFSIZ];
@@ -427,7 +427,7 @@ main(int argc, char ** argv)
printf("Total quality level = %d\n", quality);
}
else if (strcmp(output, "product") == 0) {
- printf("Total geode product = %ld\n", product);
+ printf("Total geode product = %lu\n", product);
}
else {
fprintf(stderr, "Unknown output type: %s\n", output);