From a1f701ddf6c574625f7548232c4711a9080c3a6e Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 3 Dec 2020 15:13:18 -0500 Subject: [PATCH] day3big --- aoc2020/Day3.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aoc2020/Day3.cs b/aoc2020/Day3.cs index 6649f69..56df41a 100644 --- a/aoc2020/Day3.cs +++ b/aoc2020/Day3.cs @@ -1,5 +1,6 @@ using System.IO; using System.Linq; +using System.Numerics; namespace aoc2020 { @@ -36,12 +37,11 @@ namespace aoc2020 var xSlops = new[] {2, 3, 4, 5, 8, 9, 12, 16, 18, 24, 32, 36, 48, 54, 65}; var ySlops = new[] {1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 25, 37, 41, 47}; - var slops = xSlops + return xSlops .SelectMany(x => ySlops, (x, y) => (x, y)) - .Select(s => CountSlope(s.Item1, s.Item2)); - - return slops - .Aggregate((acc, i) => acc * i) + .Select(s => CountSlope(s.Item1, s.Item2)) + .Select(s => new BigInteger(s)) + .Aggregate(BigInteger.Multiply) .ToString(); } }