Overview
Comment: | 202405 -- read second part of data |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
712548bbdf499c7bb385f72951b32d89 |
User & Date: | nnz on 2024-12-05 11:29:26 |
Other Links: | manifest | tags |
Context
2024-12-05
| ||
11:37 | 202405 -- adjust sizes; time to give it a think check-in: c180606e20 user: nnz tags: trunk | |
11:29 | 202405 -- read second part of data check-in: 712548bbdf user: nnz tags: trunk | |
11:14 | 202405 -- adjust array size check-in: 431fcb199e user: nnz tags: trunk | |
Changes
Modified aoc2024.c from [6dba97d78d] to [7ac7fd4de9].
︙ | ︙ | |||
16 17 18 19 20 21 22 | char *err; pagepair[npp][0] = strtoul(line, &err, 10); err += 1; // skip '|' pagepair[npp][1] = strtoul(line, &err, 10); npp++; line = strtok(NULL, "\n"); } | | | < > | > > > > | > > > | 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 | char *err; pagepair[npp][0] = strtoul(line, &err, 10); err += 1; // skip '|' pagepair[npp][1] = strtoul(line, &err, 10); npp++; line = strtok(NULL, "\n"); } printf("%u\n", pagepair[0][0]); unsigned update[512], nupdates, maxupdates = 0; while ((line = strtok(NULL, "\n")) != NULL) { nupdates = 0; char *err = line; for (;;) { update[nupdates++] = strtoul(err, &err, 10); if (*err == ',') err++; else break; } if (nupdates > maxupdates) maxupdates = nupdates; } printf("%u nax updates\n", maxupdates); } static size_t rcmap(unsigned size, unsigned row, unsigned col) { return row * (size + 1) + col; } static bool masat(char *data, unsigned size, unsigned row, unsigned col, int drow, int dcol) { int maxrow = (int)row + 3*drow; |
︙ | ︙ |