PAT甲级 1005. Spell It Right(20分)

简介: PAT甲级 1005. Spell It Right(20分)

1005. Spell It Right(20分)


Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.


Input Specification:

Each input file contains one test case. Each case occupies one line which contains an N (≤10100).


Output Specification:

For each test case, output in one line the digits of the sum in English words. There must be one space between two consecutive words, but no extra space at the end of a line.


Sample Input:

12345
结尾无空行


Sample Output:

one five
结尾无空行
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    string words;
    cin >> words;
    int sum = 0;
    for (char it : words)
    {
        sum += atoi(&it);
    }
    string hash[10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
    string res = to_string(sum);
    cout << hash[res[0] - '0'];
    for (int i = 1; i < res.size(); i++)
    {
        int num = res[i] - '0';
        cout << " " << hash[num];
    }
    return 0;
}
目录
相关文章
|
17天前
|
机器学习/深度学习 数据挖掘 Go
JCR一区5.2分|RNA修饰如何打开格局,一篇非肿瘤m6A带入门
这篇文章探讨了m6A修饰在绝经后骨质疏松症(PMOP)中的作用,通过生物信息学分析和实验验证,鉴定了7个m6A调节剂作为诊断标志物。研究发现这些调节剂可能影响疾病的亚型分类,并提出了m6A模式作为潜在的治疗靶点。文章提供了PMOP新的分子机制理解,为未来诊断和免疫治疗策略提供了依据。
17 0
|
4月前
|
数据安全/隐私保护 Python
BUUCTF [ACTF新生赛2020]base64隐写 1
BUUCTF [ACTF新生赛2020]base64隐写 1
105 0
BUUCTF [ACTF新生赛2020]base64隐写 1
|
17天前
|
Java 数据挖掘 Go
JCR一区7.7分|单细胞联合bulk-seq的线粒体自噬,分析方法都挺好
这篇文章介绍了研究者通过分析单细胞和Bulk RNA测序数据,鉴定出18个与胃癌(GC)进展相关的线粒体自噬相关基因(MRG),并建立了基于这些基因的预后模型。研究发现GABARAPL2和CDC37可能是GC的预后标志物和潜在治疗靶点。此外,分析揭示了细胞间通讯模式和免疫浸润状态,暗示MRG可能影响GC的免疫治疗响应。整体而言,这项工作为GC的诊断和治疗提供了新见解。
16 0
|
8月前
2022天梯赛三月冲刺——PAT (Advanced Level)1013 Battle Over Cities (并查集找连通块)
2022天梯赛三月冲刺——PAT (Advanced Level)1013 Battle Over Cities (并查集找连通块)
50 0
|
10月前
|
数据采集 数据挖掘
Tidyverse|数据列的分分合合,一分多,多合一
Tidyverse|数据列的分分合合,一分多,多合一
|
10月前
|
C++
【PAT甲级 - C++题解】1005 Spell It Right
【PAT甲级 - C++题解】1005 Spell It Right
44 0
|
11月前
|
机器学习/深度学习 Web App开发 人工智能
7 Papers & Radios | 中国天眼FAST登Nature封面;MIT提出可出题、做题、评分模型(2)
7 Papers & Radios | 中国天眼FAST登Nature封面;MIT提出可出题、做题、评分模型
202 0
|
11月前
|
机器学习/深度学习 人工智能 自然语言处理
7 Papers & Radios | 中国天眼FAST登Nature封面;MIT提出可出题、做题、评分模型(1)
7 Papers & Radios | 中国天眼FAST登Nature封面;MIT提出可出题、做题、评分模型
107 0
|
机器学习/深度学习 人工智能
PTA 7-3 拼题 A 是真爱 (20 分)
如果一个人在一段话里很多次提到 pintia,那对拼题 A 就是真爱啦~ 本题就请你检查一下给定的文字中出现了几次 pintia。
97 0
PTA 1053 住房空置率 (20 分)
在不打扰居民的前提下,统计住房空置率的一种方法是根据每户用电量的连续变化规律进行判断。
93 0