Reformat
This commit is contained in:
parent
3e6896dc6e
commit
f93d33caf7
|
@ -1,5 +1,5 @@
|
|||
var input = File.ReadAllText("../../../../inputs/1.txt").TrimEnd('\n').Split("\n\n"); // Read input file, remove trailing newlines, split by double newline
|
||||
var elves = input.Select(s => new Elf(s.Split("\n").Select(int.Parse))); // Use LINQ magic (select) to transform the collection of strings into a collection of Elves
|
||||
var elves = input.Select(s => new Elf(s.Split("\n").Select(int.Parse))); // Use LINQ magic (select) to transform the collection of strings into a collection of Elves
|
||||
|
||||
Console.WriteLine(elves.MaxBy(elf => elf.Total())!.Total()); // Output Elf with highest total number of calories
|
||||
Console.WriteLine(elves.OrderByDescending(elf => elf.Total()).Take(3).Sum(elf => elf.Total())); // Output total calories carried by top 3 elves
|
||||
|
|
Loading…
Reference in a new issue