coci 2013 contest1_tasks(6)

2021-02-21 17:46

coci试题

A marble factory has donated a large box of marbles to a kindergarten. Each marble has one out of M different colours. The governess needs to divide all the marbles between the N children in her group. It is acceptable if some children don't get any marbles. However, no child wants marbles of different colours – in other words, all marbles that a child gets need to be the same colour.

The governess also knows that children will be jealous if a child gets too many marbles. As an approximation, we will define the envy level in the group as the largest number of marbles given to one child. Help the governess divide the marbles in order to minimize the envy level.

For example, if the box contains 4 red marbles (RRRR) and 7 blue marbles (BBBBBBB) which we have to divide between 5 children, we can achieve an envy level of 3 by dividing the marbles in the following way: RR, RR, BB, BB, BBB. This is the lowest achievable envy level.

INPUT

The first line of input contains two positive integers, N (1 ≤ N ≤ 109), the number of children, and M (1 ≤ M ≤ 300 000, M ≤ N), the number of different colours.

Each of the following M lines contains a positive integer from the interval [1, 109], with the integer in line K denoting the number of marbles with colour K.

OUTPUT

The first and only line of output should contain the minimum possible envy level.

SAMPLE TESTS


coci 2013 contest1_tasks(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:人教版六年级数学下册《第四单元达标测试卷》(附答案)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: