HDU-4004 the frog's games

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.