Last active
December 5, 2020 08:37
-
-
Save piksel/d7bea4e3c23f67f542256e63ed9fcdcc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System.Linq; | |
using static System.IO.File; | |
using static System.Console; | |
int GetTreeProd(string[] map, params (int x, int y)[] strats) | |
=> strats.Aggregate(1, (a, t) => a * Enumerable.Range(0, map.Length / t.y).Count(i => map[t.y * i][t.x * i % map[0].Length] == '#')); | |
var map = ReadAllLines("input.txt"); | |
WriteLine($"Silver: {GetTreeProd(map, (3, 1))}"); | |
WriteLine($"Gold: {GetTreeProd(map, (1,1), (3,1), (5,1), (7,1), (1,2))}"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment