bzoj#P4757. [USACO2017 Jan] Building a Tall Barn
[USACO2017 Jan] Building a Tall Barn
题目描述
Farmer John is building a brand new, -story barn, with the help of his cows. To build it as quickly as possible, he needs your help to figure out how to allocate work among the cows.Each cow must be assigned to work on exactly one specific floor out of the total floors in the barn, and each floor must have at least one cow assigned to it. The iith floor requires units of total work, and each cow completes one unit of work per hour, so if cows work on floor , it will be completed in units of time. For safety reasons, floor must be completed before construction can begin on floor .
Please compute the minimum total time in which the barn can be completed, if the cows are allocated to work on floors in an optimal fashion.
Output this number rounded to the nearest integer; it is guaranteed that the solution will be more than from the boundary between two integers.
输入格式
The first line of input contains and .
The next lines contain , each a positive integer.
输出格式
Please output the minimum time required to build the barn, rounded to the nearest integer.
2 5
10
4
5
数据规模与约定
对于 的数据,满足 ,,。
题目来源
Platinum