1
0
www.mikescher.com/www/statics/aoc/2018/01-2.linq

9 lines
329 B
Plaintext
Raw Normal View History

2019-11-02 20:19:34 +01:00
<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; }
}