Submit | All submissions | Best solutions | Back to list |
HS10MVD - Movement Directions |
You are given n+1 points A0, A1, ..., An in the plane. First, you are asked to move from A0 to A1. Next, you will move through A2, A3, ..., An along the line segments.
Compute the directions you will need to turn by and the values of the cosine of the turning angle for each of the points A1, A2, ..., An-1.
Input data specification
In the first line, you are given one number 2<=n<=1000,
and in the each of the following n+1 lines, two integers:
-1000 <= xi yi <= 1000 - the coordinates of the subsequent points.
You can assume that any two consecutive points are different.
Output data specification
In n-1 consecutive lines, first print one letter L (if you are turning left) or R (if you are turning right), followed by a space and the value of the cosine of the turning angle with 6 digits' precision. If you do not turn at all but go forward at a particular point, please print just a letter F instead. Also, if you turn around and move back in the opposite direction, print only a letter B.
Example 1
Input: 5 0 0 1 0 2 0 -2 0 -2 -2 0 4 Output: F B L 0.000000 L -0.948683
Scoring
By solving this problem you score 10 points.
Added by: | kuszi |
Date: | 2011-03-16 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 ASM64 BASH BF C CSHARP C++ 4.3.2 CPP C99 CLPS CLOJURE LISP sbcl LISP clisp D ERL FSHARP FORTRAN GO HASK ICON JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PERL6 PHP PIKE PRLG-swi PYTHON PYTHON3 RUBY SCALA SCM guile SCM qobi ST TCL WHITESPACE |
Resource: | High School Programming League |