Overview
| Comment: | 202405 1st star |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
a12cf534f93dfda6d3c0dccd8b102f62 |
| User & Date: | nnz on 2024-12-05 12:15:22.114 |
| Original Comment: | 202405 -- 1 star |
| Other Links: | manifest | tags |
Context
|
2024-12-05
| ||
| 12:32 | 202405 -- structure for part 2 in place; time for a think check-in: 88be09eaef user: nnz tags: trunk | |
| 12:15 | 202405 1st star check-in: a12cf534f9 user: nnz tags: trunk | |
| 11:37 | 202405 -- adjust sizes; time to give it a think check-in: c180606e20 user: nnz tags: trunk | |
Changes
Modified aoc2024.c
from [4c494bd7a9]
to [6e28b1efce].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | + + + + + + + - + - - + + + + + - + - + + + + + - + + + |
#include <ctype.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "aocdailies.h"
#include "aocutils.h"
static const unsigned *vfind(unsigned v, const unsigned *a, size_t n) {
for (size_t k = 0; k < n; k++) {
if (a[k] == v) return a + k;
}
return NULL;
}
void aoc202405(char *data, size_t len) {
(void)len; // unused argument
unsigned pagepair[1200][2], npp = 0; // 1200 works for me
char *line = strtok(data, "\n");
while (strchr(line, '|')) {
char *err;
pagepair[npp][0] = strtoul(line, &err, 10);
err += 1; // skip '|'
|
| ︙ |