Ejemplo n.º 1
0
 public override void PartOne()
 {
     Code = InputLine.Ints().ToArray();
     for (var i = 0; i < 100; i++)
     {
         Fft();
     }
     WriteLn(Code.Take(8).Str());
 }
Ejemplo n.º 2
0
 public override void PartTwo()
 {
     InputLine.Ints()
     .Batch(Height * Width)
     .Aggregate((a, b) => a.Zip(b)
                .Select(tuple => tuple.First is 0 or 1 ? tuple.First : tuple.Second))
     .Batch(Width)
     .Select(ints => string.Concat(ints.QuickMap(1, '#', ' ')))
     .ForEach(WriteLn);
 }
Ejemplo n.º 3
0
    public override void PartOne()
    {
        var layer = InputLine.Ints()
                    .Batch(Height * Width)
                    .Select(ints => ints.Frequencies().ToDictionary())
                    .OrderBy(layer => layer[0])
                    .First();

        WriteLn(layer[1] * layer[2]);
    }