bzoj#P1734. [Usaco2005 feb]Aggressive cows 愤怒的牛
[Usaco2005 feb]Aggressive cows 愤怒的牛
题目描述
Farmer John has built a new long barn, with stalls. The stalls are located along a straight line at positions . His cows don't like this barn layout and become aggressive towards each other once put into a stall. To prevent the cows from hurting each other, FJ want to assign the cows to the stalls, such that the minimum distance between any two of them is as large as possible. What is the largest minimum distance?
农夫 John 建造了一座很长的畜栏,它包括 个隔间,这些小隔间依次编号为 。但是,John 的 头牛们并不喜欢这种布局,而且几头牛放在一个隔间里,他们就要发生争斗。为了不让牛互相伤害。John 决定自己给牛分配隔间,使任意两头牛之间的最小距离尽可能的大,那么,这个最大的最小距离是什么呢?
输入格式
-
Line : Two space-separated integers: and .
-
Lines : Line contains an integer stall location,.
-
第一行:空格分隔的两个整数 和 。
-
第二行至第 行: 行指出了 的位置。
输出格式
-
Line : One integer:the largest minimum distance.
-
第一行:一个整数,最大的最小值。
5 3
1
2
8
4
9
3
样例说明
把牛放在 ,, 这样最小距离是 。
数据规模与约定
对于 的数据,,,。
题目来源
Gold