1005 Spell It Right (20分)(一个字短!)

echarts的坐标轴处理算法 参考原文:https://www.cnblogs.com/vicky-li/p/11653415.html。2、可用于双轴的情况,指定splitNumber,保证左右两边的线没有交叉显示的情况。1、设置echarts显示的最大最小值,让数据显示比较有起伏。处理echarts的一些问题。 阅读详情

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 (≤10​100​​).
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

题意

对各位数字求和,并按照格式输出

分析

输入到string中,逐位求和

代码

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
string nums[10]={"zero","one","two","three","four","five","six","seven","eight","nine"};
char num[101];
int printNum[101];
int sum;
int main(){
 	scanf("%s",num);
 	int len=strlen(num);
	sum=0;
 	for(int i=0;i<len;i++){
  		sum+=num[i]-'0';
 	}
	int size=0;
 	if(sum==0){
  		size=1;
 	}
 	while(sum!=0){
  		printNum[size]=sum%10;
  		sum/=10;
  		size++;
 	}
 	for(int i=size-1;i>=0;i--){
  		printf("%s",nums[printNum[i]].c_str());
  		if(i!=0)
  		printf(" ");
 	}
 	return 0;
}
9.13华为OD机试真题 新系统 - 手机桌面整理 (Java/Py/C/C++/Js/Go) 华为OD机试真题 新系统【手机桌面整理】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题 【 手机桌面整理】多语言题解。 阅读详情

相关推荐

WSL2不能上网,Failed to connect to github.com port 443问题解决方案

WSL2不能上网: 问题:ping外网无效 例如:ping www.baidu.com失败 解决方案: 在wsl: $sudo vi /etc/wsl.conf wsl.conf: [network] generateResolvConf = false 在PowerShell: $sudo vi /etc/etc/resolv.conf resolv.conf: # This file was automatically generated by WSL. To stop automatic gen

Jason_Chen__的博客 9527

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

virgilshi的博客 705

手把手教你用Excel自动化处理G14大额风险暴露报表(含211版模板)

本文针对G14大额风险暴露报表(含211版)手工填报效率低、易出错的核心痛点,提供了一套基于Excel VBA的完整自动化解决方案。文章详细讲解了如何构建从数据采集、清洗、关联客户识别、风险暴露计算到自动化校验与归档的完整工作流,并附有可操作的代码示例,旨在帮助银行风控人员大幅提升报表处理效率与准确性。

weixin_29304985的博客 450

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

题目来源:PAT(甲级) 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: ...

sinat_41835935的博客 166

VS2019 从零构建 OSG+OSGEarth+OSGQt 开发环境实战指南

本文提供了一份详细的实战指南,指导开发者如何在Windows系统下使用VS2019从零开始编译和配置OSG、OSGEarth与OSGQt开发环境。文章涵盖了从环境准备、源码获取、CMake配置、Visual Studio编译到最终测试的完整流程,并分享了关键的避坑技巧,旨在帮助三维GIS与可视化开发者高效搭建稳定、可控的专业开发平台。

weixin_28826961的博客 368

资治通鉴:文言文、白话文对照读本

介绍一处可以免费下载资治通鉴的网址,该文献共20卷,排版为左边是文言文,右边是白话文翻译,对照阅读非常方便。下面是1-20卷的链接地址:第一卷:http://www.docin.com/p-9705067.html 第二卷:http://www.docin.com/p-9705979.html 第三卷:http://www.docin.com/p-9709382.html 第四卷:

aiwis的专栏 2548

1005 Spell It Right (20)(20 分)

1005 Spell It Right (20)(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 ...

码奴生来就只知道前进 1445

SAP 交货成本(运费)

交货成本: 业务场景: 有些产品或供应商,会产生交货成本(运费、关税等) 业务模拟(以运费为例): 1、运费在采购订单体现:计划运费 ME21N创建采购订单,并且包含运费: MIGO收货时: 由上可知,MIGO时运费最终体现在库存(存货)科目中(V),或者价格差异中(S计价时)。 MIRO发票校验: 运费最终体现在单独科目中: 后台配置: 运费在发票时候...

willieyuan的博客 1万+

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 c

weixin_45331809的博客 360

中国农业银行——轻量式云原生应用平台(轻云平台)

2021年10月,中国人民银行等联合发布了《关于规范金融业开源技术应用与发展的意见》(银办发〔2021〕146 号),规范金融机构合理应用开源技术,提高应用水平和自主可控能力,促进开源技术健康可持续发展。前期,为助力成员单位做好开源技术应用与发展工作,北京金融科技产业联盟开源专委会组织了金融业开源技术应用、创新等方面的案例征集,现对部分优秀案例进行宣传,发挥先进典型示范引领作用。申报单位:中国农业银行股份有限公司技术领域:云原生、无服务器架构(Serverless)、DevOps。

银行信息系统应用架构详解 2394

超十万字解读Spring AI实战:开篇

大模型技术正以惊人的速度改变世界,2025年的人工智能已不再是科幻,而是现实。大模型如ChatGPT等,正在重塑各行各业,降低技术门槛,使专业能力普及化。SpringAI的出现为Java开发者提供了桥梁,使其能在企业级系统中稳定运行AI,同时保持工程化思维。尽管SpringAI在生态、学习成本和性能上存在不足,但其企业级基因和国产化适配能力使其成为Java开发者的重要工具。本系列文章旨在介绍SpringAI的功能与特性,鼓励更多Java开发者参与AI实践,共同探索AI时代的无限可能。

liaokailin的专栏 1578

PAT练习题(甲级) 1005 Spell It Right (20分)(Java实现)

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

CoderHqf的博客 9557

innovus:streamOut gds中pg text带有冒号(:)解决办法

streamOut后查看layout,发现部分PG text后面加了冒号,比如VDD: / VSS:。当然,这个问题还有另一种解决办法,就是通过脚本给terminal打text再streamOut。我正在「拾陆楼」和朋友们讨论有趣的话题,你⼀起来吧?

m0_61544122的博客 1192

【PAT甲级 - C++题解】1005 Spell It Right

📣专栏定位:为想考甲级PAT的小伙伴整理常考算法题解,祝大家都能取得满分!

Newin2020的博客 726

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

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

cp0328的博客 3332

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

pat-1005 Spell It Right (20分)

pat-1005 Spell It Right (20分) 1.在这再一次用到了to_string()的方法,其实这里求和也不一定这样写。辗转相除求数位的和还是很简答的。 2.for-each循环的使用自己去搜索一下,也是比较简单的。而且用for-each如果是输出所有的范围,就不用自己去考虑范围。 #include <iostream> using namespace std; int main(){ string n; cin>>n; int sum=0

weixin_44110100的博客 136

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

PAT A1005 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 c

weixin_45964844的博客 140

PAT 甲级题目讲解:1005《Spell It Right》

本文讲解 PAT 甲级 1005 题《Spell It Right》的完整解题思路与 C++ 实现。题目要求对最多 100 位的非负整数求数位和,并将和的每一位以英文单词输出。文章分三步展开:字符串读取与特判、数位求和、数字拆解与英文映射输出,并附完整代码、常见错误提醒及复杂度分析,适合备考 PAT 甲级的读者参考。

qq_35624947的博客 457

字符串—PAT 1005 Spell It Right

字符串—PAT 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 lin

苏苏和柚子 141

1005 Spell It Right (20分)用例4

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

JoahChen的博客 461

1005 Spell It Right (20分)

Given a non-negative integerN, your task is to compute the sum of all the digits ofN, and output every digit of the sum in English. Input Specification: Each input file contains one test case. Eac...

一定要站在自己热爱的生活里闪闪发光 3万+

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

dggnqzt6462的博客 146

[PAT] 1005 Spell It Right (20 分)Java

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

Simma1101的博客 221

1005 Spell It Right (20 分) Java实现

1005 Spell It Right (20 分) Java实现 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 ...

uu22222的博客 354

【PAT甲级】1005 Spell It Right (20 分)

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

初见还是重逢的博客 280

PATA1005 Spell It Right (20分)

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

沧夜的成长日记 613
上一篇: 1004 Counting Leaves (30分)(一个字短!)
下一篇: 1006 Sign In and Sign Out (25分)(一个字短!)
大了七八个
博客等级 码龄8年 2粉丝 30原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值