#P2551. [AHOI2001] 华夏60战斗机
[AHOI2001] 华夏60战斗机
Description
The Huaxia 60 supersonic fighter jet is one of the most maneuverable fighters in the world today. A key issue in combat is how to climb/dive from the current flight altitude and speed to a designated altitude and achieve a designated speed in the shortest time to gain a superior combat position.
Assume that the Huaxia 60 is allowed to perform only the following three basic maneuvers, and a new basic maneuver can only start after the previous one is completed. Thus, a flight can be represented as a sequence composed of these three basic maneuvers.
(1) Maintain the current speed and perform a constant-speed climb until the flight altitude increases by feet.
(2) Perform horizontal acceleration until the speed increases by 1 Mach (1 Mach km/h).
(3) Perform a vertical dive by feet, during which the flight speed increases by 1 Mach.
Also assume that the initial flight speed and the speed at the beginning of each basic maneuver are integer multiples of 1 Mach and do not exceed 6 Mach; the initial flight altitude and the altitude at the beginning of each basic maneuver are integer multiples of feet (where is an integer).
Experimental studies show that the time required to complete the above three basic maneuvers varies with different altitudes and initial speeds . Tables 1–3 give the required times when feet and the maximum flight altitude is feet.
Based on the data in Tables 1–3, the shortest time for the Huaxia 60 to reach the flight state feet, Mach starting from feet, Mach is 79 seconds, and the corresponding sequence of maneuvers is:

(1) Constant-speed climb to feet, Mach.
(2) Perform two consecutive horizontal accelerations to feet, Mach.
(3) Perform four consecutive constant-speed climbs to feet, Mach.
(4) Horizontal acceleration to feet, Mach.
(5) Perform two consecutive vertical dives to feet, Mach.
(6) Perform two consecutive constant-speed climbs to feet, Mach.
Now Xiao Ming is flying the Huaxia 60 at Mach at altitude feet. The squadron commander orders him to fly at Mach at altitude feet. Please write a program to decide how to fly so that the order is completed in the least time.
Input Format

Output Format
The output contains two lines.
- The first line contains the time required by your optimal plan.
- The second line contains the action sequence of the optimal plan (use R for constant-speed climb, A for horizontal acceleration, and D for vertical dive). No extra characters (including whitespace) are allowed on the second line.
0 1 75000 6 15000 75000
12 12 12 11 12 14
11 10 8 9 10 11
9 8 6 7 8 8
8 7 6 6 6 5
8 6 6 6 6 5
11 11 11 13 15
10 10 9 9 10
10 9 9 10 10
9 8 9 9 10
7 8 8 9 9
7 7 7 8 8
5 4 3 3 2
4 3 3 2 2
3 3 2 2 2
3 3 2 2 2
79
RAARRRRADDRR
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号