aocc22

Advent of Code 2022
git clone git://www.tkruger.se/aocc22.git
Log | Files | Refs | README

uppga.c (314B)


      1 #include "common.h"
      2 
      3 int main(int argc, char **argv) {
      4   char **lines;
      5   size_t nlines = readlines(&lines, "input");
      6 
      7   int64_t sum = 0;
      8 
      9   size_t i;
     10   for (i = 0; i < nlines; i++) {
     11     sum += snafu2i64(lines[i], strlen(lines[i]) - 1);
     12   }
     13 
     14   char buf[256];
     15   i64_2snafu(buf, 256, sum);
     16 
     17   printf("%s\n", buf);
     18 }