aboutsummaryrefslogtreecommitdiff
path: root/2023/12
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/12
parent6a480c4eb9c96c82a8fd3663f0fbee4d32e56f19 (diff)
downloadaoc-94d0033ed89bb5bfb6500051296892fb7cea6c29.tar.gz
aoc-94d0033ed89bb5bfb6500051296892fb7cea6c29.zip
Small cleanup
Diffstat (limited to '2023/12')
-rw-r--r--2023/12/12a.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/2023/12/12a.c b/2023/12/12a.c
index d88ed9a..129746f 100644
--- a/2023/12/12a.c
+++ b/2023/12/12a.c
@@ -1,14 +1,10 @@
1#include <inttypes.h>
2#include <stdbool.h>
3#include <stdio.h> 1#include <stdio.h>
4#include <stdlib.h> 2#include <stdlib.h>
5#include <string.h> 3#include <string.h>
6 4
7#define N 1000 5#define N 1000
8 6
9#define MAX(a,b) ((a)>(b)?(a):(b)) 7#define ABS(a) ((a)>0?(a):-(a))
10#define MIN(a,b) ((a)<(b)?(a):(b))
11#define ABS(a) MAX((a),-(a))
12 8
13#define isnum(c) (c == '-' || (c >= '0' && c <= '9')) 9#define isnum(c) (c == '-' || (c >= '0' && c <= '9'))
14 10
@@ -16,7 +12,7 @@ char *buf, line[N];
16int s, n, a[N]; 12int s, n, a[N];
17 13
18int readl(int nums[], char *buf) { 14int readl(int nums[], char *buf) {
19 int64_t i; 15 int i;
20 for (i = 0; *buf; buf++) { 16 for (i = 0; *buf; buf++) {
21 if (!isnum(*buf)) continue; 17 if (!isnum(*buf)) continue;
22 nums[i++] = atoll(buf); 18 nums[i++] = atoll(buf);

Generated with cgit - Back to sebastiano.tronto.net