A. Anton and Polyhedrons

Codeforces
IDCF785A
Time2000ms
Memory256MB
Difficulty
implementationstrings
English · Original
Chinese · Translation
Formal · Original
Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: * _Tetrahedron_. Tetrahedron has 4 triangular faces. * _Cube_. Cube has 6 square faces. * _Octahedron_. Octahedron has 8 triangular faces. * _Dodecahedron_. Dodecahedron has 12 pentagonal faces. * _Icosahedron_. Icosahedron has 20 triangular faces. All five kinds of polyhedrons are shown on the picture below: <center>![image](https://espresso.codeforces.com/51d90af2e3b31c36f12732b895a92e9b8d2b82bc.png)</center>Anton has a collection of _n_ polyhedrons. One day he decided to know, how many faces his polyhedrons have in total. Help Anton and find this number! ## Input The first line of the input contains a single integer _n_ (1 ≤ _n_ ≤ 200 000) — the number of polyhedrons in Anton's collection. Each of the following _n_ lines of the input contains a string _s__i_ — the name of the _i_\-th polyhedron in Anton's collection. The string can look like this: * "_Tetrahedron_" (without quotes), if the _i_\-th polyhedron in Anton's collection is a tetrahedron. * "_Cube_" (without quotes), if the _i_\-th polyhedron in Anton's collection is a cube. * "_Octahedron_" (without quotes), if the _i_\-th polyhedron in Anton's collection is an octahedron. * "_Dodecahedron_" (without quotes), if the _i_\-th polyhedron in Anton's collection is a dodecahedron. * "_Icosahedron_" (without quotes), if the _i_\-th polyhedron in Anton's collection is an icosahedron. ## Output Output one number — the total number of faces in all the polyhedrons in Anton's collection. [samples] ## Note In the first sample Anton has one icosahedron, one cube, one tetrahedron and one dodecahedron. Icosahedron has 20 faces, cube has 6 faces, tetrahedron has 4 faces and dodecahedron has 12 faces. In total, they have 20 + 6 + 4 + 12 = 42 faces.
Anton 最喜欢的几何图形是正多面体。注意,正多面体共有五种: 所有五种多面体如下图所示: Anton 拥有一个包含 #cf_span[n] 个正多面体的收藏。有一天,他想知道他的所有多面体一共有多少个面。请帮助 Anton 求出这个总数! 输入的第一行包含一个整数 #cf_span[n] #cf_span[(1 ≤ n ≤ 200 000)] —— Anton 收藏中多面体的数量。 接下来的 #cf_span[n] 行,每行包含一个字符串 #cf_span[si] —— Anton 收藏中第 #cf_span[i] 个正多面体的名称。该字符串可能如下所示: 请输出一个数字 —— Anton 收藏中所有多面体的面数总和。 在第一个样例中,Anton 有一个二十面体、一个立方体、一个四面体和一个十二面体。二十面体有 #cf_span[20] 个面,立方体有 #cf_span[6] 个面,四面体有 #cf_span[4] 个面,十二面体有 #cf_span[12] 个面。它们总共有 #cf_span[20 + 6 + 4 + 12 = 42] 个面。 ## Input 输入的第一行包含一个整数 #cf_span[n] #cf_span[(1 ≤ n ≤ 200 000)] —— Anton 收藏中多面体的数量。接下来的 #cf_span[n] 行,每行包含一个字符串 #cf_span[si] —— Anton 收藏中第 #cf_span[i] 个正多面体的名称。该字符串可能如下所示: "_Tetrahedron_"(不含引号),如果第 #cf_span[i] 个正多面体是四面体。 "_Cube_"(不含引号),如果第 #cf_span[i] 个正多面体是立方体。 "_Octahedron_"(不含引号),如果第 #cf_span[i] 个正多面体是八面体。 "_Dodecahedron_"(不含引号),如果第 #cf_span[i] 个正多面体是十二面体。 "_Icosahedron_"(不含引号),如果第 #cf_span[i] 个正多面体是二十面体。 ## Output 请输出一个数字 —— Anton 收藏中所有多面体的面数总和。 [samples] ## Note 在第一个样例中,Anton 有一个二十面体、一个立方体、一个四面体和一个十二面体。二十面体有 #cf_span[20] 个面,立方体有 #cf_span[6] 个面,四面体有 #cf_span[4] 个面,十二面体有 #cf_span[12] 个面。它们总共有 #cf_span[20 + 6 + 4 + 12 = 42] 个面。
**Definitions** Let $ n \in \mathbb{Z} $ be the number of polyhedrons, with $ 1 \leq n \leq 200{,}000 $. Let $ S = (s_1, s_2, \dots, s_n) $ be a sequence of strings, where each $ s_i \in \{ \text{"Tetrahedron"}, \text{"Cube"}, \text{"Octahedron"}, \text{"Dodecahedron"}, \text{"Icosahedron"} \} $ denotes the type of the $ i $-th polyhedron. Define the face function $ f: \{ \text{"Tetrahedron"}, \text{"Cube"}, \text{"Octahedron"}, \text{"Dodecahedron"}, \text{"Icosahedron"} \} \to \mathbb{Z} $ as: $$ f(\text{"Tetrahedron"}) = 4, \quad f(\text{"Cube"}) = 6, \quad f(\text{"Octahedron"}) = 8, \\ f(\text{"Dodecahedron"}) = 12, \quad f(\text{"Icosahedron"}) = 20 $$ **Objective** Compute the total number of faces: $$ \sum_{i=1}^{n} f(s_i) $$
Samples
Input #1
4
Icosahedron
Cube
Tetrahedron
Dodecahedron
Output #1
42
Input #2
3
Dodecahedron
Octahedron
Octahedron
Output #2
28
API Response (JSON)
{
  "problem": {
    "name": "A. Anton and Polyhedrons",
    "description": {
      "content": "Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: *   _Tetrahedron_. Tetrahedron has 4 triangular faces. *   _Cube_. Cube has 6 squar",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF785A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons:\n\n*   _Tetrahedron_. Tetrahedron has 4 triangular faces.\n*   _Cube_. Cube has 6 squar...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "Anton 最喜欢的几何图形是正多面体。注意,正多面体共有五种:\n\n所有五种多面体如下图所示:\n\nAnton 拥有一个包含 #cf_span[n] 个正多面体的收藏。有一天,他想知道他的所有多面体一共有多少个面。请帮助 Anton 求出这个总数!\n\n输入的第一行包含一个整数 #cf_span[n] #cf_span[(1 ≤ n ≤ 200 000)] —— Anton 收藏中多面体的数量。\n\n接...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of polyhedrons, with $ 1 \\leq n \\leq 200{,}000 $.  \nLet $ S = (s_1, s_2, \\dots, s_n) $ be a sequence of strings, where each $ s_i \\in \\{ \\text{...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments