diff options
Diffstat (limited to 'advent-of-code/2022/01/1.c')
| -rw-r--r-- | advent-of-code/2022/01/1.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/advent-of-code/2022/01/1.c b/advent-of-code/2022/01/1.c deleted file mode 100644 index 8886515..0000000 --- a/advent-of-code/2022/01/1.c +++ /dev/null @@ -1,25 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#define BUFSZ 1024 - -char buf[BUFSZ]; - -int main() { - int maxval = 0; - int cur = 0; - FILE* fp = fopen("input", "r"); - while (fgets(buf, BUFSZ, fp)) { - int len = strlen(buf); - char *end; - if (len <= 1) { - maxval = cur > maxval ? cur : maxval; - cur = 0; - } else { - cur += strtol(buf, &end, 10); - } - } - printf("%d\n", maxval); - return 0; -} |
