-
-
Save randrew/c6d911cef9a9e4183f1873d4aad77fbd to your computer and use it in GitHub Desktop.
aoc 2020 day 5 revengeance edition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
int a, i, c, t = 0, m = 0xfff, M = 0; | |
for (;;) { | |
for (a = i = 0; i < 11; i++) a |= (~(c = getchar()) & 4) << 7 >> i; | |
if (c == EOF) break; | |
if (a > M) M = a; | |
if (a < m) m = a; | |
t += a; | |
} | |
printf("%d\n%d\n", M, (M * M + M - m * m + m >> 1) - t); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment