Anton and Polyhedrons

简介: Anton and Polyhedrons

文章目录

一、 Anton and Polyhedrons

总结


一、 Anton and Polyhedrons

本题链接:Anton and Polyhedrons


题目:

A. Anton and Polyhedrons

time limit per test2 seconds

memory limit per test256 megabytes

inputstandard input

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

image.png

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

4

Icosahedron

Cube

Tetrahedron

Dodecahedron

output

42

input

3

Dodecahedron

Octahedron

Octahedron

output

28

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.


本博客给出本题截图:

image.png

image.png

题意:不同的字符串代表不同的数字,输入n个字符串,问这些字符串对应数字的和

AC代码

#include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
    map<string, int> m;
    m["Tetrahedron"] = 4;
    m["Cube"] = 6;
    m["Octahedron"] = 8;
    m["Dodecahedron"] = 12;
    m["Icosahedron"] = 20;
    int n;
    cin >> n;
    int res = 0;
    while (n -- )
    {
        string a;
        cin >> a;
        res += m[a];
    }
    cout << res << endl;
    return 0;
}

总结

水题,不解释


目录
相关文章
|
3月前
|
机器学习/深度学习 存储 缓存
115_LLM基础模型架构设计:从Transformer到稀疏注意力
大型语言模型(LLM)的架构设计是其性能的核心决定因素。从2017年Transformer架构的提出,到如今的稀疏注意力和混合专家模型,LLM架构经历了快速的演进。本文将全面探讨LLM基础架构的设计原理,深入分析Transformer的核心机制,详细介绍稀疏注意力、MoE等创新架构,并展望未来架构发展方向。通过数学推导和实践案例,为构建高效、强大的LLM提供全面指导。
|
存储 算法 API
Python学习五:函数、参数(必选、可选、可变)、变量、lambda表达式、内置函数总结、案例
这篇文章是关于Python函数、参数、变量、lambda表达式、内置函数的详细总结,包含了基础知识点和相关作业练习。
211 0
修改端口范围
1、查看命令 [root@www ~]# sysctl -a | grep local 或cat /proc/sys/net/ipv4/ip_local_port_range 2、修改端口范围 1)永久修改 vi /etc/sysctl.conf 添加下面一行: net.ipv4.ip_local_port_range = 1024 65535 然后执行: sysctl -p 生效。
1586 0
|
4天前
|
云安全 人工智能 算法
以“AI对抗AI”,阿里云验证码进入2.0时代
三层立体防护,用大模型打赢人机攻防战
1315 4
|
4天前
|
机器学习/深度学习 安全 API
MAI-UI 开源:通用 GUI 智能体基座登顶 SOTA!
MAI-UI是通义实验室推出的全尺寸GUI智能体基座模型,原生集成用户交互、MCP工具调用与端云协同能力。支持跨App操作、模糊语义理解与主动提问澄清,通过大规模在线强化学习实现复杂任务自动化,在出行、办公等高频场景中表现卓越,已登顶ScreenSpot-Pro、MobileWorld等多项SOTA评测。
660 3
|
5天前
|
人工智能 Rust 运维
这个神器让你白嫖ClaudeOpus 4.5,Gemini 3!还能接Claude Code等任意平台
加我进AI讨论学习群,公众号右下角“联系方式”文末有老金的 开源知识库地址·全免费
|
11天前
|
编解码 人工智能 自然语言处理
⚽阿里云百炼通义万相 2.6 视频生成玩法手册
通义万相Wan 2.6是全球首个支持角色扮演的AI视频生成模型,可基于参考视频形象与音色生成多角色合拍、多镜头叙事的15秒长视频,实现声画同步、智能分镜,适用于影视创作、营销展示等场景。
766 6