[Problem description]
At the party, we are playing a "violent motorcycle" game, it has very realistic picture and sound effects, such as galloping car whistling, motorcycle engine sound and cornering tires and ground friction produced by the noise. And it added a confrontation element in the game, you can use boxing, feet to interfere with each other, make it behind you, is not very despicable ah? The game must not be lenient, because the opponent will take the initiative to attack you. If you meet the police who drive a motorcycle, although you can also kick a foot, but you have to be careful, if they caught, then GAME over!
Of course, the car is always to refuel, the known track long S kilometer (s≤10000 integer, and a multiple of 10), the car's fuel consumption q=1, that is 1 kilometers road consumption 1 units of oil. Q Unchanged, the car's fuel tank is infinite, at the same time can refuel anywhere along the way. Agreed that the number of each refueling is an integer, and a multiple of 10, the speed of the car with the car after refueling the total amount of oil. The relationship is listed as follows:
at the same time, the car each refueling time to take a T-minute (t<=100 no matter how much, the start of refueling regardless of time)
when the s,t given, choose an optimal refueling plan. Make the car finish the journey at the least time.
For example: when S=40,t=6 (minutes), refueling scheme has many kinds, list some:
1 start refueling 40, spents 40/75≈0.53 hour
2 start refueling 20, Midway plus 20, spents 20/90+20/90+6/60 (into hours) ≈ 0.54 hours
[input file]
row, two integers s, T. Output
file
output row, for minimum (leave two decimal places)
[input sample]
6
[Output SAMPLE]
Ideas for solving problems
Dp.
We find that the way ahead is not related to the back, then we can use a "I" to indicate the shortest time to travel i*10 kilometers. To search for the minimum time for each phase a "I", then a "n" is the answer code
var s,i,j,t:longint;
A:array[1..1000]of Real;
M,min:real;
Begin assign (input, ' car.in ');
Assign (output, ' car.out ');
Reset (input);
Rewrite (output);
READLN (s,t); For I:=1 to S Div ten do//every 10 km for a phase begin case I of 1:min:=10/100;
Calculate from 0 start to i*10 distance if not refueling, the minimum time, to the current stage a "I" of the initial value of min, the current phase will i*10 as the endpoint 2:min:=20/90;
3:MIN:=30/80;
4:MIN:=40/75;
else min:= (I*10)/70;
End For the j:=1 to I-1 do//enumeration of each possible refueling place, test if you add 1 oil here, then the end of this to the finish can reduce the time, that is, to find the best solution begin case (I-J) of//(I-J) *10 from
The distance 1:m:=10/100 the current j*10 to the current phase endpoint i*10;
2:M:=20/90;
3:M:=30/80;
4:M:=40/75;
Else m:= ((i-j) *10)/70;
End
M:=M+T/60; If M+a[j]<min then min:=m+a[j]; Compare, look Can you make the total of the current phase a "I"Time reduction end;
A[i]:=min;
End
Write (a[s div 10]:0:2);
Close (input);
Close (output);
End. No test OJ can be found anywhere ... So also do not know a not a