aboutsummaryrefslogtreecommitdiff
path: root/2023/20/20b.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-12-25 17:56:34 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-12-25 17:56:34 +0100
commit94d0033ed89bb5bfb6500051296892fb7cea6c29 (patch)
tree245eac2218310c958c2df2fad5109ea4f7b2a9d9 /2023/20/20b.c
parent6a480c4eb9c96c82a8fd3663f0fbee4d32e56f19 (diff)
downloadaoc-94d0033ed89bb5bfb6500051296892fb7cea6c29.tar.gz
aoc-94d0033ed89bb5bfb6500051296892fb7cea6c29.zip
Small cleanup
Diffstat (limited to '2023/20/20b.c')
-rw-r--r--2023/20/20b.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/2023/20/20b.c b/2023/20/20b.c
index dc0d6b3..a6f549d 100644
--- a/2023/20/20b.c
+++ b/2023/20/20b.c
@@ -1,7 +1,7 @@
1/* 1/*
2This one is a bit weird. This program works only for my specific input 2This one is a bit weird. This program works only for my specific input.
3(included in this folder). Similarly to number 8, this program outputs 3Similarly to day 8, this program outputs 4 numbers and you have to
44 numbers and you have to take the lcm of them. 4take the lcm of them.
5 5
6I solved it this way: 6I solved it this way:
71. First, using a modified version of the code for part one (graph.c), 71. First, using a modified version of the code for part one (graph.c),
@@ -19,7 +19,6 @@ I solved it this way:
19#include <inttypes.h> 19#include <inttypes.h>
20#include <stdbool.h> 20#include <stdbool.h>
21#include <stdio.h> 21#include <stdio.h>
22#include <stdlib.h>
23#include <string.h> 22#include <string.h>
24 23
25#define N 100 24#define N 100
@@ -97,11 +96,9 @@ bool isclean(void) {
97} 96}
98 97
99int64_t period(int node) { 98int64_t period(int node) {
100 int64_t npush = 0; 99 int64_t npush;
101 do { 100 for (npush = 0; npush == 0 || !isclean(); npush++)
102 sig(node, false); 101 sig(node, false);
103 npush++;
104 } while (!isclean());
105 return npush; 102 return npush;
106} 103}
107 104

Generated with cgit - Back to sebastiano.tronto.net