aoc-2020-zig

Advent of Code 2020 Solutions in Zig
git clone https://git.sinitax.com/sinitax/aoc-2020-zig
Log | Files | Refs | README | sfeed.txt

part1 (1555B)


      1--- Day 1: Report Repair ---
      2
      3After saving Christmas five years in a row, you've decided to take a vacation at a nice resort on a tropical island. Surely, Christmas will go on without you.
      4
      5The tropical island has its own currency and is entirely cash-only.  The gold coins used there have a little picture of a starfish; the locals just call them stars. None of the currency exchanges seem to have heard of them, but somehow, you'll need to find fifty of these coins by the time you arrive so you can pay the deposit on your room.
      6
      7To save your vacation, you need to get all fifty stars by December 25th.
      8
      9Collect stars by solving puzzles.  Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first.  Each puzzle grants one star. Good luck!
     10
     11Before you leave, the Elves in accounting just need you to fix your expense report (your puzzle input); apparently, something isn't quite adding up.
     12
     13Specifically, they need you to find the two entries that sum to 2020 and then multiply those two numbers together.
     14
     15For example, suppose your expense report contained the following:
     16
     171721
     18979
     19366
     20299
     21675
     221456
     23
     24In this list, the two entries that sum to 2020 are 1721 and 299. Multiplying them together produces 1721 * 299 = 514579, so the correct answer is 514579.
     25
     26Of course, your expense report is much larger. Find the two entries that sum to 2020; what do you get if you multiply them together?
     27
     28