您的位置:首页 > 其它

hiho一下 第六十九周 题目1 : HIHO Drinking Game 二分

2015-10-30 17:46 465 查看


题目1 : HIHO Drinking Game

时间限制:10000ms
单点时限:1000ms
内存限制:256MB


描述

Little Hi and Little Ho are playing a drinking game called HIHO. The game comprises N rounds. Each round, Little Hi pours T milliliter of water into Little Ho's cup then Little Ho rolls a K-faces dice to get a random
number d among 1 to K. If the remaining water in Little Ho's cup is less than or equal to d milliliter Little Hi gets one score and Little Ho drinks up the remaining water, otherwise Little Ho gets one score and Little Ho drinks exactly d milliliter of water
from his cup. After N rounds who has the most scores wins.
Here comes the problem. If Little Ho can predict the number d of N rounds in the game what is the minimum value of T that makes Little Ho the winner? You may assume that no matter how much water is added, Little
Ho's cup would never be full.


输入

The first line contains N(1 <= N <= 100000, N is odd) and K(1 <= K <= 100000).

The second line contains N numbers, Little Ho's predicted number d of N rounds.


输出

Output the minimum value of T that makes Little Ho the winner.

样例输入
5 6
3 6 6 2 1


样例输出
4
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: