From 86bac31392a76da84817eec020d2b84d099b3cc1 Mon Sep 17 00:00:00 2001 From: mhsn Date: Wed, 18 Mar 2026 21:48:13 +0000 Subject: add other challenges support --- aoc/2025/01/c.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 aoc/2025/01/c.c (limited to 'aoc/2025/01/c.c') diff --git a/aoc/2025/01/c.c b/aoc/2025/01/c.c new file mode 100644 index 0000000..115ea13 --- /dev/null +++ b/aoc/2025/01/c.c @@ -0,0 +1,19 @@ +#include +#include +#include + +int main() +{ + char dir; + int64_t n; + int64_t p = 50; + int64_t p1 = 0, p2 = 0; + while (scanf("%c%ld ", &dir, &n) == 2) { + int64_t new = p + (dir == 'R' ? n : -n); + p2 += labs(new) / 100 + (p != 0 && new <= 0); + p = (p = new % 100) >= 0 ? p : p + 100; + p1 += p == 0; + } + printf("silver: %ld\ngold: %ld", p1, p2); + return 0; +} -- cgit v1.2.3