| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 595 人关注过本帖
标题:大问题,求大牛解一下
只看楼主 加入收藏
枫叶无痕
Rank: 2
等 级:论坛游民
帖 子:80
专家分:30
注 册:2011-2-10
结帖率:73.91%
收藏
 问题点数:0 回复次数:5 
大问题,求大牛解一下
The Frog's Games

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)

Problem Description
The 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 across the river, at least what ability should they have. (That is the frog's longest jump distance).
 

Input
The 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.
 

Output
For each case, output a integer standing for the frog's ability at least they should have.
 

Sample Input
6 1 2
2
25 3 3
11
2
18
 

Sample Output
4
11
搜索更多相关主题的帖子: kingdom started Memory annual stones 
2011-09-03 15:36
落叶深蓝色
Rank: 8Rank: 8
来 自:山东
等 级:蝙蝠侠
帖 子:319
专家分:807
注 册:2010-12-8
收藏
得分:0 
晕,大连1004,
2011-09-03 15:51
草狼
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:2
帖 子:577
专家分:1040
注 册:2010-4-6
收藏
得分:0 
这都可以0.0
2011-09-03 16:01
vesapro
Rank: 2
等 级:论坛游民
帖 子:11
专家分:27
注 册:2011-8-29
收藏
得分:0 
你好,
似乎是计算最多要用m次跳跃跳过河的情况下, 每次跳跃需要跳过的最短距离。即,要求青蛙们至少要具备这个跳远能力才能在规定的m次跳跃中跳过河。
第一行: 河的宽度l, 石头个数n, 跳跃次数m
m..从河岸开始,每个落脚点之间的距离(注:一个落脚点允许出现连个石头,就这里可以出现0值);

算法:把落脚点间距数组转换为距出发点岸边的距离数组,对于有n个石头,最多跳m次的情况, 任意选取n-1个石头,然后他们之间的顺序间距:
岸边和1之间,2和3之间, 3和4之间,。。。n和对岸之间的间距算出,然后和平均值 L/m比较,得出instance 保留最大值(最大的间距);然后遍历所有可能选择,找出instance最小的那种选择。即使题目的要求;
我感觉就是遍历求最优路径;
2011-09-03 16:15
枫叶无痕
Rank: 2
等 级:论坛游民
帖 子:80
专家分:30
注 册:2011-2-10
收藏
得分:0 
回复 4楼 vesapro
这个会超时的,可不可以给个代码看看
2011-09-03 16:26
fei741878347
Rank: 2
等 级:论坛游民
帖 子:35
专家分:45
注 册:2011-3-20
收藏
得分:0 
2011-09-03 18:25
快速回复:大问题,求大牛解一下
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034972 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved