17
1
using System;
2
using System.Collections.Generic;
3
4
public class Program
5
{
6
public void Main()
7
{
8
Console.WriteLine(f(new List<int>{1, 1, 4, 2, 0}));
9
Console.WriteLine(f(new List<int>{2, 2, 2, 2, 2}));
10
Console.WriteLine(f(new List<int>{0, 6, 0, 6, 0}));
11
Console.WriteLine(f(new List<int>{12, 5, 3, 2, 1}));
12
Console.WriteLine(f(new List<int>{1, 14, 14, 3, 2}));
13
Console.WriteLine(f(new List<int>{0, 0, 1, 0, 50}));
14
}
15
16
int f(List<int>p){p.Sort();p[3]--;p[4]--;return p[2]-->0?1+f(p):0;}
17
}
Cached Result