hdu 5935 Car(贪心)

Problem Description
Ruins is driving a car to participating in a programming contest. As on a very tight schedule, he will drive the car without any slow down, so the speed of the car is non-decrease real number.

Of course, his speeding caught the attention of the traffic police. Police record N positions of Ruins without time mark, the only thing they know is every position is recorded at an integer time point and Ruins started at 0.

Now they want to know the minimum time that Ruins used to pass the last position.

 

Input
First line contains an integer T, which indicates the number of test cases.

Every test case begins with an integers N, which is the number of the recorded positions.

The second line contains N numbers a1, a2, , aN, indicating the recorded positions.

Limits
1T100
1N105
0<ai109
ai<ai+1

 

Output
For every test case, you should output ‘Case #x: y’, where x indicates the case number and counts from 1 and y is the minimum time.

 

Sample Input
1
3
6 11 21

Sample Output

Case #1: 4
给出n个时间点(时间点必须是整数)的车的位置,为到n号时间点记录的位置时最少通过的时间。
clearY,老司机他们说在杭州被卡精度了,然而窝表示为什么会有精度问题呢?囧
因为速度不减,所以说最后一段的速度肯定最快,那么就可以得到一个式子:,然后只要保证时间是整数就可以了。递推求解。。。

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注