PAT(Advanced Level) 1005 - Spell It Right (水题)

【PAT (Advanced Level) Practice】1005 Spell It Right (20 分) #include<iostream> #include<cstdio> #include<cstdlib> #include<string> #include<cstring> #include<map> using namespace std; int a[105]; int main(int argc, char** argv) { string str; cin>>str; int sum=0; for ( 阅读详情

*1005. Spell It Right (20)

时间限制
400 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
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

AC代码:

#include<bits/stdc++.h>
using namespace std;
string word[10] = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
int main()
{
    int sum = 0;
    string a;
    cin>>a;
    for(int i = 0;a[i];i++) sum += a[i]-'0';
    stack<int>t;
    if(!sum)    t.push(0);
    while(sum)  t.push(sum%10),sum /= 10;
    int cnt = 0;
    while(!t.empty())
    {
        if(cnt) cout<<" ";else  cnt++;
        cout<<word[t.top()];t.pop();
    }
    return 0;
}
Ubuntu20.04下Intel AX201网卡驱动安装全攻略:从内核升级到固件更新 本文详细介绍了在Ubuntu 20.04系统上解决Intel AX201无线网卡驱动问题的完整方案。针对戴尔游匣G15等新硬件,通过升级内核至HWE版本、从官方仓库获取最新固件文件,并调整BIOS设置,彻底解决Wi-Fi无法识别或连接不稳定的问题,为开发者提供了一套从诊断到修复的实践指南。 阅读详情

相关推荐

SAP PCC成本收集器实战:从配置到结算的完整流程解析

本文详细解析了SAP PCC成本收集器从配置到结算的完整流程,特别适用于重复制造行业。通过实战案例和配置要点,帮助用户掌握物料分类账管理、成本中心费用归集及差异分析等核心功能,提升企业生产成本控制效率。

weixin_29251567的博客 903

「PAT甲级真题解析」Advanced Level 1005 Spell It Right

题设明确要求我们将给定的一个非负数的各个数字相加求和, 然后输出这个和各个数字的英文形式, 妥妥的模拟题, 而且步骤已经非常明确。 需要考虑的是给定的非负数最大可以是10^100(101位, 1个一后面跟了100个零), 所以需要用字符串来存储整数.

过美好生活,做高效程序员 5223

未隔离电源设备使用usb转串口调试导致串口模块爆炸烧坏事故记录

这个事就发生在前两天,我们公司的wifi模块被客户用到了咖啡机上,客户寄了一台整机给我们协助调试,还送了几包咖啡豆,本想着还能打个咖啡喝一喝的,但就在咖啡机刚寄过来第一天,就出事了。而这个事故的发生,竟然仅仅是因为同事接了个串口模块到电脑调试打印导致的。谁也想不到,这个3.3V的供电的wifi模块居然还有这么大的威力。直接将usb转TTL串口模块的转换芯片给爆开了,咖啡机也给弄坏了,据同事描述当时情况就只见到一片火光和一声巨响,状况比较惨烈,所幸的是笔记本电脑没有烧坏,但是直接给崩蓝屏了。 ...

fangye945a的博客 6212

PAT (Advanced Level) 1005 Spell It Right

PAT 1005 Practice 题目: 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 conta...

chizhonghang的博客 247

智能排班考勤系统原型

可实现从业务预测,到工时预估,再到人员分配全流程自动智能排班。可应用于客服行业或工厂的智能排班系统。

gywm15111336483的专栏 999

单细胞专题(1) | 单细胞转录组研究样本准备指南(上)

单细胞RNA测序(scRNA-seq)是目前最前沿,能进行大规模实验的转录组研究技术,为理解细胞组成和动态生物学过程提供了很多新的见解。单细胞研究已经为我们理解发育过程,老化和疾病(如癌症)等提供了大量数据。在这里,小编主要就前期的样本准备与保存需注意问题给大家进行讲解,以备大家在不同的研究场景和研究背景下,走好单细胞转录组学研究的第一步。

bioyigene的博客 4235

PAT (Advanced Level) Practice 1005 Spell It Right

1005Spell It Right(20分) 时间限制: 400 ms 内存限制: 64 MB 代码长度限制: 16 KB Given a non-negative integerN, your task is to compute the sum of all the digits ofN, and output every digit...

huang 255

LAMMPS实操系列(一): 大量FCC-CoCrCuFeNi高熵合金建模与最稳定结构筛选

高熵合金(High-entropy alloys,HEA),是由五种或五种以上等量或大约等量金属形成的合金。由于高熵合金可能具有许多优秀的物理化学性质,因此在材料科学领域受到广泛关注

Ceshigo_CD的博客 3264

PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642

PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642 题目描述: 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. 译:给出一个非负整数 N , 你的任务是计算出 N 的每位数的和,并且用英语输出和的每一位数。 Inp

lingchen1120的博客 205

Unreal5从入门到精通之如何在VR中使用3DUI

前面我们讲过《Unreal5从入门到精通之UMG的使用》一般制作游戏时,UI都是添加到屏幕视窗上面的,但是在制作VR时,我们往往需要制作一个3D的UI,放置在场景中,然后使用手柄的射线来和UI进行交互。今天我们就来讲解下,如何在VR中创作和交互3DUI首次操作会感觉好复杂,多多练习,当你熟悉了UE蓝图的操作后会发现,这只是一个常规的蓝图操作而已。祝大家在虚幻的学习过程中非常顺利。希望这篇博客对你有所帮助。

TxNet 1995

电阻基础知识及应用电路仿真(Multisim)

本文围绕硬件工程师必备的电阻知识,从基础知识、实操、应用仿真三方面做系统讲解:基础上明确电阻的核心参数、分类、串并联计算及核心特性;实操中详解贴片/色环电阻的阻值读取、贴片封装换算,重点区分0Ω电阻(贴装跳线,实现功能选通/调试等)与磁珠(高频吸噪)的差异及选型;应用上介绍限流、分压、上拉/下拉、阻抗匹配、过压/过流保护五大典型电路的设计公式、选型原则和实操要点,同时给出电阻通用的选型、测量和布线设计规范,形成完整的电阻应用知识体系。

XU157303764的博客 2795

PAT (Advanced Level) 1005 Spell It Right (20分)

PAT (Advanced Level) 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...

Adolphrocs的博客 272

福彩快乐8智能选号系统研究

本文介绍了一款福彩快乐8智能选号系统的开发过程。系统首先通过数据采集获取历史开奖数据,作为分析的基础。随后,对采集的数据进行深入分析,以识别可能的模式和趋势。基于这些分析,系统能够智能预测未来的开奖号码,如2025129期的预测。最后,通过模拟兑奖功能,用户可以直观地看到预测结果的实际效果。文章鼓励感兴趣的读者点赞并领取源代码,以便自行探索和使用该系统。

gumuzi1210的博客 2234

PAT_Advanced Level_1005 Spell It Right(C++_模拟)

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

ccql's Blog 320

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

PAT甲级1005 Spell It Right

Each input file contains one test case. Each case occupies one line which contains an N (≤10的100次方).

song0789的博客 559

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

【PAT】【Advanced Level】1005. Spell It Right (20)

基础题

wakawaka 339

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

PAT (Advanced Level) Practice 1005 Spell It Right

                                    1005 Spell It Right 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 Sp...

Dunk.Wan 241

PAT Advanced Level 1005 Spell It Right 解题思路及AC代码 v1.0

字符串基础题

thexiaosi的博客 334

1005 Spell It Right

题目来源:PAT (Advanced Level) Practice 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 c.

weixin_51032998的博客 75

PAT (Advanced Level) T1005 Spell It Right

link 题目描述 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. 输入描述 Each input file contains one test case. Each cas...

总是WA题的十四的博客 130

PAT1005 Spell It Right

题解 原题链接 这题比较简单,字符串输入,然后每一项求和,求和结果一定在1000以内就分别讨论然后switch case输出对应英文字母就可以了 AC代码 #include &amp;lt;iostream&amp;gt; #include &amp;lt;cstdio&amp;gt; using namespace std; void print(int a); int main() { string s; ...

adventural的博客 309

PAT甲级(Advanced Level) Practice 1005 Spell It Right

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 (≤).Output Spec

2301_78006009的博客 583

【PAT (Advanced Level) Practice】1005 Spell It Right

甲级开始准备技能升级了 vector和string开始代替数组和字符串数组了 然后一些关于树啊 图啊 栈和队列之类的题 我准备后做 因为浙大数据结构的网课还有10天才课,到时候跟进度做 #include<stdio.h> #include<string.h> #include<string> #include<vector> #include<...

weixin_41635596的博客 181

PAT (Advanced Level) Practice — 1005 Spell It Right (20 分)

题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805519074574336 Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of th...

Mongo_girl 227
上一篇: PAT(Advanced Level) 1004 - Counting Leaves(树)
下一篇: PAT(Advanced Level) 1006 - Sign In and Sign Out(水题)
Snakeflute
博客等级 码龄11年 14粉丝 172原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值