forked from vedantpople4/problem_solving_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path785A.cpp
More file actions
55 lines (46 loc) · 1.78 KB
/
785A.cpp
File metadata and controls
55 lines (46 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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.
#CODE:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,sum=0;
cin>>n;
string a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
if(a[i] =="Tetrahedron")
sum+=4;
else if(a[i]=="Cube")
sum+=6;
else if(a[i]=="Octahedron")
sum+=8;
else if(a[i]=="Dodecahedron")
sum+=12;
else if(a[i]=="Icosahedron")
sum+=20;
}
cout<<sum;
return 0;
}