Skip to content

Instantly share code, notes, and snippets.

@EBojilova
Last active August 29, 2015 14:19
Show Gist options
  • Save EBojilova/887be14de62a6cfc5e31 to your computer and use it in GitHub Desktop.
Save EBojilova/887be14de62a6cfc5e31 to your computer and use it in GitHub Desktop.
BiggestTriple
using System;
using System.Collections.Generic;
using System.Linq;
class BiggestTriple
{
static void Main()
{
int[] numbers = Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));
int size = 3;
var result = numbers.Select((x, i) => new { Key = i / size, Value = x }).GroupBy(x => x.Key, x => x.Value).OrderByDescending(a => a.Sum()).First();
Console.WriteLine(string.Join(" ", result));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment