当前位置: 代码迷 >> C语言 >> 这个题目该怎么做.翻译一下.
  详细解决方案

这个题目该怎么做.翻译一下.

热度:289   发布时间:2006-10-26 23:10:08.0
这个题目该怎么做.翻译一下.

A long, linear field has N (1 <= N <= 1,000) clumps of grass at unique integer locations on what will be treated as a number line.Think of the clumps as points on the number line.

Bessie starts at some specified integer location L on the number line (1 <= L <= 1,000,000) and traverses the number line in the two possible directions (sometimes reversing her direction) in order to reach and eat all the clumps. She moves at a constant speed (one unit of distance in one unit of time), and eats a clump instantly when she encounters it.

Clumps that aren't eaten for a while get stale. We say the "staleness" of a clump is the amount of time that elapses from when Bessie starts moving until she eats a clump. Bessie wants to minimize the total staleness of all the clumps she eats.

Find the minimum total staleness that Bessie can achieve while eating all the clumps.

Input
* Line 1 : Two space-separated integers: N and L.
* Lines 2..N+1: Each line contains a single integer giving the position P of a clump (1 <= P <= 1,000,000).


Output
* Line 1: A single integer: the minimum total staleness Bessie can achieve while eating all the clumps.

Sample Input


4 10
1
9
11
19


Sample Output


44

搜索更多相关的解决方案: 翻译  

----------------解决方案--------------------------------------------------------
我的英文也很烂,帮你顶
----------------解决方案--------------------------------------------------------
同上~~
----------------解决方案--------------------------------------------------------
最近搞这个的好象特别多................
----------------解决方案--------------------------------------------------------

楼上的大哥,帮忙翻下了.


----------------解决方案--------------------------------------------------------

没人翻译,偶来试一下.
大意是这样:
一块田地上有N(1<=N<=1000)块草丛,田地可看成一条直线,草丛可看成直线上的点.
一个叫贝茜的家伙(貌似是头牛),想吃掉所有的草.她以1m/s的速度移动(当然可以左右移动)
当她到达有草的地方,立即把草吃掉.
然后定义 一块草丛的"staleness" 是贝茜从刚开始移动到吃掉这块草丛的时间.
第一行给出草丛的数量N和贝系的初始位置L,
第二行给出草丛的位置.

当贝系吃完所有的草,求出所能达到的最小的"staleness"..

4 10
1
9
11
19


10->9->11->19->1
1+3+11+29=44


发现自己翻译的真土.........





----------------解决方案--------------------------------------------------------
头疼..见到英文头就疼
----------------解决方案--------------------------------------------------------
什么地方拿出来题目。
----------------解决方案--------------------------------------------------------

一块长为N(1<=N<=1000)且被当作由唯一一组数字标示的数字草田。在这个数线上,每一个草块被看成是一个点。
贝西在草田上的某个特定位置(L,1 <= L <= 1,000,000)出发。并且在走这条数字线时允许走两个方向(有时要掉转它的方向)为了够着并且吃完所有的草地。她是以匀速前进的(单位时间单位距离)当她遇到草地时就吃草。
没被吃掉的草会变质。我们说的陈年旧草是指从贝西开始走动到吃完这块草地所需的时间。贝西想她吃完所有草的陈旧时间之和最少。

/*自己瞎翻译出来了,可是做的是错误的*/


----------------解决方案--------------------------------------------------------
6楼英语不错啊。
偶的就太烂了!
----------------解决方案--------------------------------------------------------
  相关解决方案