eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Vacuum-Bot

Vacuum-Bot

A large room with dusty floor is represented as a \textbf{2-D} plane. You have a disc-shaped robot (the vacuum-bot) that traverses the floor while vacuuming the dust underneath. Given the trajectory of the vacuum-bot from the instant it is powered-on to the instant it is powered-off, your task is to calculate the total area of dust-free floor at the end of vacuum-bot operation. The vacuum-bot is represented as a circle with \textbf{diameter 1}. Initially the entire floor is dusty and the vacuum-bot faces \textbf{east}. The trajectory of the vacuum-bot is encoded as a string whose characters sequentially describe one of four actions: \begin{itemize} \item \textbf{s}: The vacuum-bot steps forward by \textbf{1} (and vacuums portions of the floor it sweeps over). \item \textbf{r}: The vacuum-bot turns clockwise by \textbf{90°}. \item \textbf{l}: The vacuum-bot turns counter-clockwise by \textbf{90°}. \item \textbf{x}: The vacuum-bot is turned off. \end{itemize} For example, the string \textbf{ssrslsx} encodes the following vacuum-bot trajectory: \includegraphics{https://static.e-olymp.com/content/f2/f26da5ef57a4139f884b97b22b0f34e59a6c97f9.jpg} Dust-free floor is shown in blue. Its total area is \textbf{3.5 + 0.375 π ≈ 4.6781}. You may assume that the vacuum-bot never encounters any obstacle (walls, humans, giant dust bunnies), and no new dust will appear. Note that there are multiple, independent test cases. \InputFile The first input line contains the number of test cases \textbf{N}, \textbf{1} ≤ \textbf{N} ≤ \textbf{100}. Each test case consists of a string \textbf{s} on a single line, representing the trajectory of the vacuum-bot. \begin{itemize} \item \textbf{1} ≤ \textbf{length(s)} ≤ \textbf{100}. \item \textbf{s} consists of characters '\textbf{s}', '\textbf{r}', '\textbf{l}', until the last character, which is always '\textbf{x}'. \end{itemize} \OutputFile For each test case, print the total area of dust-free floor after vacuum-bot operation, to \textbf{4} decimal places, on a single line.c
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
3
sx
ssrslsx
srsrsrsrx
Выходные данные #1
1.7854
4.6781
3.7854
Источник University of Toronto 2010 ACM Tryout: Saturday, October 2, 2010