Overview
| Comment: | redo some formatting |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
6d26cab7c24d4b26c7d863015983b0f7 |
| User & Date: | nnz on 2024-12-08 13:23:21.680 |
| Other Links: | manifest | tags |
Context
|
2024-12-08
| ||
| 14:40 | merge TextGrid check-in: 2f2a7645d9 user: nnz tags: trunk | |
| 13:23 | redo some formatting check-in: 6d26cab7c2 user: nnz tags: trunk | |
| 13:22 | 202408 wip check-in: a382d65717 user: nnz tags: trunk | |
Changes
Modified aoc2024.c
from [8deec3b966]
to [50f843a30c].
| ︙ | ︙ | |||
50 51 52 53 54 55 56 |
}
printf("There are %u antinodes within the map.\n", nanti);
}
/* === aoc202407 =======================================================
Part one looks easy
Part two also easy
| | | | | | | | | | | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
}
printf("There are %u antinodes within the map.\n", nanti);
}
/* === aoc202407 =======================================================
Part one looks easy
Part two also easy
===================================================================== */
static unsigned long long concat(unsigned long long a, unsigned long long b) {
unsigned long long r = a, t = b;
while (b) {
r *= 10;
b /= 10;
}
return r + t;
}
static int operatorsrequired(unsigned long long v, unsigned long long *a, size_t n, int minop) {
// assumes no unsigned long long overflowing
if (n == 1) {
if (v == *a) return minop;
return 0;
}
unsigned long long tmp = a[1];
int pplus, pmult, pconcat = 0;
a[1] = a[0] + tmp;
pplus = operatorsrequired(v, a+1, n-1, 2);
a[1] = tmp;
a[1] = a[0] * tmp;
|
| ︙ | ︙ |