diff options
Diffstat (limited to '2023/12/12a.c')
| -rw-r--r-- | 2023/12/12a.c | 8 |
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]; | |||
| 16 | int s, n, a[N]; | 12 | int s, n, a[N]; |
| 17 | 13 | ||
| 18 | int readl(int nums[], char *buf) { | 14 | int 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); |
