namespace BlackJack { class b2798 { static void Main(string[] args) { string[] input = Console.ReadLine().Split(); string[] num = Console.ReadLine().Split();
int[] num_list = new int[int.Parse(input[0])]; for (int i = 0; i < num.Length; i++) { num_list[i] = int.Parse(num[i]); }
b2798 sol = new b2798(); int s = sol.solution(int.Parse(input[1]), num_list); Console.WriteLine(s); } public int solution(int target_number, int[] list) { int sol = 0;
for(int i = 0; i < list.Length-2; i++) { for(int j = i+1; j < list.Length-1; j++) { for(int k = i+2; k < list.Length; k++) { int sum = list[i] + list[j] + list[k]; if((sum <= target_number) && (sum > sol)) { sol = sum; } } } }
namespace Sugar_Delivery { class b2839 { static void Main(string[] args) { int val = int.Parse(Console.ReadLine());
Console.WriteLine(solution(val));
}
static int solution(int sugar) { int sol = sugar; int cnt = 0;
for(int i = 0; i <= (sugar / 5); i++) { // i = big plastic bag num for(int j = 0; j <= (sugar - (5 * i)); j++) { // j = small plastic bag num if (((5 * i + 3 * j) == sugar) && i + j < sol) { sol = i + j; cnt++; } } }