1
0
www.mikescher.com/www/statics/aoc/2018/01_solution-2.linq
2019-12-02 14:27:20 +01:00

9 lines
329 B
C#

<Query Kind="Statements" />
HashSet<int> visited = new HashSet<int>();
int sum = 0;
foreach (var v in Enumerable.Repeat(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"01_input.txt")).Select(int.Parse), int.MaxValue).SelectMany(p=>p))
{
sum += v;
if (!visited.Add(sum)) { sum.Dump(); return; }
}