In binary search, first find the maximum distance, left, and the L value is right. The frog's games
Time Limit: 2000/1000 MS (Java/others) memory limit: 65768/65768 K (Java/others) total submission (s): 3720 accepted submission (s): 1803
Problem descriptionthe annual Games in frogs 'Kingdom started again. the most famous game is the ironfrog triathlon. one test in the ironfrog triathlon is jumping. this project requires the frog athletes to jump over the river. the width of the river is L (1 <= L <= 1000000000 ). there are N (0 <=n <= 500000) stones lined up in a straight line from one side to the other side of the river. the frogs can only jump through the river, but they can land on the stones. if they fall into the river, they are out. the frogs was asked to jump at most M (1 <= m <= n + 1) times. now the frogs want to know if they want to jump into ss the river, at least what ability shoshould they have. (that is the frog's longest Jump Distance ). inputthe input contains several cases. the first line of each case contains three positive integer L, N, and M. then n lines follow. each stands for the distance from the starting banks to the nth stone, two stone appear in one place is impossible. outputfor each case, output a integer standing for the frog's ability at least they shoshould have. sample input6 1 2225 3 311 2 18 Sample output411 sourcethe 36th ACM/ICPC Asia Regional Dalian site -- online contest
HDU-4004 the frog's games