#P2625. 豪华游轮
豪华游轮
Description
There is a luxury cruise ship (actually just a small wooden boat). This ship can execute types of commands:
right X: where is an integer from to . This command rotates the ship clockwise by degrees.
left X: where is an integer from to . This command rotates the ship counterclockwise by degrees.
forward X: where is an integer ( to ). This command moves the ship units straight ahead along its current heading.
backward X: where is an integer ( to ). This command moves the ship units straight backward along its current heading.
You are given commands written in arbitrary order. Find a way to arrange these commands so that the ship’s final position is as far from the starting point as possible.
Input Format
The first line contains an integer , representing the number of given commands.
The next lines each contain one command.
Output Format
Output a floating-point number: the maximum achievable distance, rounded to decimal places.
3
forward 100
backward 100
left 90
141.421356
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号