#P3680. [CERC2016] 凸轮廓线 Convex Contour
[CERC2016] 凸轮廓线 Convex Contour
Description
Some geometric figures are arranged neatly from left to right in a single row on a square grid. They occupy a consecutive segment of one row, with exactly one figure in each cell. Each figure is one of the following three:
- A square that exactly fills a single cell.
- A circle inscribed in a single cell.
- An equilateral triangle whose base coincides with the bottom edge of the cell.

The side length of each cell is . Compute the perimeter of the convex hull of these figures.
Input Format
The first line contains a positive integer , the number of figures.
The second line contains characters, describing each figure from left to right: S denotes a square, C denotes a circle, and T denotes an equilateral triangle.
Output Format
Output a single real number, the perimeter of the convex hull. Your answer will be accepted if the absolute or relative error does not exceed .
4
TSTC
9.088434417
Hint
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号