P2965 [USACO09NOV] The Grand Farm-off S

题目描述

Farmer John owns 3\*N (1

输入格式

\* Line 1: Ten space-separated integers: N, a, b, c, d, e, f, g, h, and M

输出格式

\* Line 1: A single integer representing the lowest sum of the weights of the N cows with the highest net utility.

说明/提示

The functions generate weights of 5, 6, 9, 14, 21, and 30 along with utilities of 0, 1, 8, 27, 64, and 125. The two cows with the highest utility are cow 5 and 6, and their combined weight is 21+30=51.