about summary refs log tree commit diff
path: root/aoc/2024/03/part-one.c
diff options
context:
space:
mode:
Diffstat (limited to 'aoc/2024/03/part-one.c')
-rw-r--r--aoc/2024/03/part-one.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/aoc/2024/03/part-one.c b/aoc/2024/03/part-one.c
new file mode 100644
index 0000000..0438304
--- /dev/null
+++ b/aoc/2024/03/part-one.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+int main()
+{
+	size_t x, y, s = 0;
+	while (scanf("%*[^m]") != EOF)
+		if (scanf("mul(%3zu,%3zu", &x, &y) == 2 && getchar() == ')')
+			s += x * y;
+	printf("%zu\n", s);
+	return 0;
+}