logo AlgoBeat OnlineJudge
登录 注册

#104757. [BZOJ 4757] [Usaco2017 Jan]Building a Tall Barn

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:传统 评测方式:无测试数据
上传者: 匿名

题目描述

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.

样例

样例输入 #1

2 5
10
4

样例输出 #1

5

数据范围与提示

对于 的数据,满足

Platinum