37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
a[1] = tmp;
if (!pplus && !pmult) {
a[1] = concat(a[0], tmp);
pconcat = operatorsrequired(v, a+1, n-1, 3);
a[1] = tmp;
}
if (pconcat) return 3;
if (pmult) return pmult;
if (pplus) return pplus;
return 0;
}
void aoc202407(char *data, size_t len) {
(void)len; // unused argument
unsigned long long calibrationtotal = 0, calibration3total = 0;
char *line = strtok(data, "\n");
|
|
<
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
a[1] = tmp;
if (!pplus && !pmult) {
a[1] = concat(a[0], tmp);
pconcat = operatorsrequired(v, a+1, n-1, 3);
a[1] = tmp;
}
if (pconcat) return 3;
if (pplus || pmult) return (pplus > pmult) ? pplus : pmult;
return 0;
}
void aoc202407(char *data, size_t len) {
(void)len; // unused argument
unsigned long long calibrationtotal = 0, calibration3total = 0;
char *line = strtok(data, "\n");
|