Pat A1005 Spell It Right

UNITY3D万人同屏,Dots万人同屏解决方案_类萌宠宠之战 UNITY3D弹幕游戏开发,万人同屏解决方案 阅读详情

英语单词,不要用string进行存放,用char存放。For example:

 char str [10][10] = {"zero","one","two","three","four","five","six","seven","eight","nine"};

很简单的一道题。

#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main(){
    char str [10][10] = {"zero","one","two","three","four","five","six","seven","eight","nine"};//不能用string

    char tempch;

    int sum = 0;
    tempch = getchar();

    while(tempch != '\n'){
        sum = sum + tempch - '0';
        tempch = getchar();
    }

    int in[105];

    int len = 0;
    if(sum == 0){
        in[len ++] = 0;
    }



    while(sum != 0){
        in[len ++] = sum % 10;
        sum = sum / 10;
    }
    for(int i = len - 1;i >= 0;i --){
        printf("%s",str[in[i]]);
        if(i != 0) {
            printf(" ");
        }
    }

    printf("\n");
    return 0;
}

《UDS协议从入门到精通》系列——图解0x2E:通过ID写数据 图解数据包格式+直观的通信示例,迅速认识0x2E服务!! 阅读详情

相关推荐

从真题到策略:浙江工业大学计算机转专业机试全解析与备考指南

本文全面解析浙江工业大学计算机转专业机试的考试概况、典型真题和高频考点,提供详细的备考策略和面试准备建议。从机试题目类型到解题技巧,帮助考生高效备考,顺利通过这一竞争激烈的转专业关卡。

weixin_42524824的博客 421

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

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

Newin2020的博客 726

Dataset - DeepFashion 服装数据集

Dataset - DeepFashion 服装数据集 [Dataset - DeepFashion] [Project - DeepFashion] 1. 服装类别和属性预测集 [Category - Attribute 下载] [百度网盘] 289,222 张服装图片 clothes images; 50 个服装类别 clothing categories 1,000 ...

长风破浪会有时,直挂云帆济沧海 2万+

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

zhangpiu的专栏 391

从零实现机械臂抓取仿真:用MoveIt+Gazebo完成物体pick&place全流程

本文详细介绍了如何使用ROS的MoveIt框架与Gazebo仿真环境,从零构建机械臂抓取仿真系统。涵盖环境搭建、MoveIt配置、Gazebo集成、抓取动作实现等全流程,帮助开发者掌握机械臂控制的核心技术,实现高效的pick&place任务。

weixin_29250403的博客 476

Java Swing教程-16. Swing中的图形绘制

这篇教程介绍了Java Swing中的图形绘制功能,主要内容包括: Graphics类的基本使用 - 介绍了如何重写paintComponent方法实现自定义绘制,以及基本图形绘制方法(线条、矩形、椭圆、多边形等) 文本与图片绘制 - 讲解了文本绘制方法、字体设置和图片加载绘制技术 颜色与字体设置 - 包括预定义颜色、RGB自定义颜色、透明色设置以及字体样式控制 案例实现 - 提供了一个简单绘图程序的框架,支持鼠标绘制不同图形、选择工具和自定义颜色等功能 教程通过代码示例详细演示了各种绘图操作,适合Java

无 233

PAT_A_1005

题目概述 输入一串数字N(≤10100),求出这串数字各个位上数字之和,并用对应数字的英文输出和,每一位用一个空格隔开,最后一位没有空格。 Sample Input: 12345 Sample Output: one five 分析 这道题目是考察对字符串中的字符取对应数求和,以及对数据的正逆序输出的使用。 首先要解决的问题是,怎么用英文表示对应的数字。枚举?宏定义?不,当然是不用这样的,只需要一...

Kamikas的博客 358

YOLOv8【第十二章:数据增强与数据工程篇·第10节】主动学习(Active Learning):如何挑选最有价值的样本进行标注!

🏆 本文收录于 《YOLOv8实战:从入门到深度优化》 专栏。该专栏系统复现并梳理全网各类 YOLOv8 改进与实战案例(当前已覆盖分类 / 检测 / 分割 / 追踪 / 关键点 / OBB 检测等方向),坚持持续更新 + 深度解析,质量分长期稳定在 97 分以上,可视为当前市面上 覆盖较全、更新较快、实战导向极强 的 YOLO 改进系列内容之一。

**My Coding Family** 508

PAT A1005 Spell It Right

水题,取到每位操作然后按索引输出就行; 唯一需要注意的就是输入十进制的100次方,超出了整型范围,所以要用字符串来存储; #include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;stdio.h&gt; #include&lt;iostream&gt; #include&lt;string&gt; #include&lt;v...

InNoVaion_yu的博客 349

【华为OD机试真题】4、字符统计及重排 | 机试真题+思路参考+代码解析(C++、Java、Py)

题目描述 >给出一个仅包含字母的字符串,不包含空格,统计字符串中各个字母(区分大小写)出现的次数, 并按照字母出现次数从大到小的顺序。输出各个字母及其出现次数。 如果次数相同,按照自然顺序进行排序,且小写字母在大写字母之前

KJ.JK 3289

沁恒CH32V30X学习笔记02--GPIO的使用教程及2次封装驱动

刚复位后,GPIO 口运行在初始状态,这时大多数 IO 口都是运行在状态所有的 GPIO 口都可以被配置外部中断输入通道,但一个外部中断输入通道最多只能映射到一个GPIO 引脚上,且外部中断通道的序号必须和 GPIO 端口的位号一致,,两方都是一对一的关系。复用功能。

Car12 706

PAT a1005题解

#include #include char* change(int n){ switch(n){ case 0: return "zero"; break; case 1: return "one"; break; case 2: return "two"; break; case 3: return "three"; break; case 4: return "f

Tang's学习笔记 340

AgentScope Java 2.0 项目实战: 从零构建自己的个人AI助手“小龙虾“

本文系统介绍如何基于Spring Boot WebFlux、React 18和TypeScript,从零搭建一个本地化的个人AI助手管理平台——AgentScope Paw。项目支持多Agent创建与管理、SSE流式对话、工作区文件CRUD、技能市场、子智能体孵化、AI辅助起草Agent配置等核心功能,并深度集成钉钉、企业微信、飞书、GitHub等IM通道。

program哲学 1427

[PAT A1005]Spell It Right

[PAT A1005]Spell It Right 题目描述 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. 输入格式 Each...

欢迎来到我的编程小屋 620

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

[PAT-A 1005]Spell It Right

题目大意: 给出一个非负数N,求出位数之和,并用英文表示这个总和的数位的每一位 思路: 1.N<10^100,最大和为每位都是9的情况,即数位最大和会有100*9=900。 2.用二维数组num[10][10]存放0-9对应的单词,sum存放N的各位数之和。 3.将sum的位数由高到低对应到num数组中输出。 AC代码: //PAT_A 1005 #include<cstdio&gt...

RegulusF的博客 234

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

PAT-A1005 Spell It Right【大数处理】

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

gdc6916的博客 3万+

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

PAT A1005:Spell It Right

题目描述 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 fil...

lilian的博客 168

PAT_A1005 | Spell It Right

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

weixin_43787043的博客 233

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

#include <iostream> #include<string.h> using namespace std; int main() { char digit[10][10]={"zero","one","two","three","four","five","six","seven","eight","nine"}; char str[110];...

MIKET_T的博客 222

pat A1005 Spell It Right

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

larry1648637120的博客 171

PAT:A1005 Spell It Right

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

Ecloss 405

【PAT】PAT A1005 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 ...

elegant coder 1369
上一篇: Pat B1024/A1073科学计数法
下一篇: Pat A 1082 Read Number in Chinese
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值