#P3680. [CERC2016] 凸轮廓线 Convex Contour

    ID: 1172 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>字符串数学计算几何2016Special Judge凸包

[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:

  1. A square that exactly fills a single cell.
  2. A circle inscribed in a single cell.
  3. An equilateral triangle whose base coincides with the bottom edge of the cell.

The side length of each cell is 11. Compute the perimeter of the convex hull of these figures.

Input Format

The first line contains a positive integer nn, the number of figures.

The second line contains nn 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 10610^{-6}.

4
TSTC
9.088434417

Hint

For 100%100\% of the testdata, 1n201 \le n \le 20.

Translated by ChatGPT 5