CF

来源:互联网 发布:国家电网数据运维 编辑:程序博客网 时间:2024/06/06 01:48

1.题目描述:

A. Anton and Polyhedrons
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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:

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 si — 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.

Examples
input
4IcosahedronCubeTetrahedronDodecahedron
output
42
input
3DodecahedronOctahedronOctahedron
output
28
Note

In the first sample Anton has one icosahedron, one cube, one tetrahedron and one dodecahedron. Icosahedron has 20 faces, cube has 6faces, tetrahedron has 4 faces and dodecahedron has 12 faces. In total, they have 20 + 6 + 4 + 12 = 42 faces.

2.题意概述:

告诉你一些多边形的面数,然后n次询问,问你所有询问面数总和是多少。

3.解题思路:

模拟相加就行

4.AC代码:

#include <bits/stdc++.h>#define INF 0x3f3f3f3f#define maxn 100100#define N 1111#define eps 1e-6#define pi acos(-1.0)#define e exp(1.0)using namespace std;const int mod = 1e9 + 7;typedef long long ll;typedef unsigned long long ull;int main(){#ifndef ONLINE_JUDGEfreopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);long _begin_time = clock();#endifint n;while (~scanf("%d", &n)){char ch[15];int ans = 0;while (n--){scanf("%s", ch);if (ch[0] == 'T')ans += 4;else if (ch[0] == 'C')ans += 6;else if (ch[0] == 'O')ans += 8;else if (ch[0] == 'D')ans += 12;elseans += 20;}printf("%d\n", ans);}#ifndef ONLINE_JUDGElong _end_time = clock();printf("time = %ld ms.", _end_time - _begin_time);#endifreturn 0;}close

0 0
原创粉丝点击