Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var paperNeeded = input.Select(a => new
{
SurfaceArea = 2 * a.Item1 * a.Item2 + 2 * a.Item1 * a.Item3 + 2 * a.Item2 * a.Item3,
Extra = Math.Min(Math.Min(a.Item1 * a.Item2, a.Item1 * a.Item3), a.Item2 * a.Item3)
}).Sum(b => b.SurfaceArea + b.Extra);
var ribbonNeeded = input.Select(a => new
{
Permiter = Math.Min(Math.Min(2 * (a.Item1 + a.Item3), 2 * (a.Item2 + a.Item3)), 2 * (a.Item2 + a.Item1)),
Extra = a.Item1 * a.Item2 * a.Item3
}).Sum(b => b.Permiter + b.Extra);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.