PAT-A 1005 Spell It Right (20)

【PAT】 A1005. Spell It Right (20) A1005. Spell It Right (20) 阅读详情
#include <iostream>
#include <cstdio>
#include <stack>
using namespace std;

int main()
{
    char c;
    int sum=0;
    while(scanf("%c",&c))
    {
        if(c=='\n')
        {
            break;
        }
        sum+=c-'0';
    }
    if(sum==0)
    {
        cout<<"zero";
    }
    else
    {
        stack<int> a;
        while(sum!=0)
        {
            a.push(sum%10);
            sum/=10;
        }
        int t,flag=0;
        while(!a.empty())
        {
            if(flag)
            {
                cout<<" ";
            }
            flag=1;
            t=a.top();
            a.pop();
            switch(t)
            {
            case 0:
                cout<<"zero";
                break;
            case 1:
                cout<<"one";
                break;
            case 2:
                cout<<"two";
                break;
            case 3:
                cout<<"three";
                break;
            case 4:
                cout<<"four";
                break;
            case 5:
                cout<<"five";
                break;
            case 6:
                cout<<"six";
                break;
            case 7:
                cout<<"seven";
                break;
            case 8:
                cout<<"eight";
                break;
            case 9:
                cout<<"nine";
                break;
            }
        }
    }
}

 

STM32单片机:驱动ADS1115四个通道全开程序 本文介绍了德州仪器(TI)的ADS1115高精度16位模数转换器(ADC)及其应用实现。该芯片具有16位分辨率、可编程增益放大器(PGA)和低功耗特性,支持±0.256V至±6.144V量程。文章提供了完整的C语言驱动代码,包括初始化、配置寄存器读写、单次/连续转换模式设置、电压值读取等功能实现。代码通过I2C接口与ADS1115通信,支持多通道选择和不同PGA设置,可实现高精度模拟信号采集。该方案适用于需要精密测量的嵌入式系统,如传感器数据采集等应用场景。 阅读详情

相关推荐

CodeBuddy 接入 MCP,一键生成网站!

2024 年 11 月,Anthropic 公司搞了个挺有意思的新玩意 - Model Context Protocol(模型上下文协议)简称为 MCP 协议。简单来说,它就是给 AI 和各类工具数据之间搭了个标准化的”桥梁”,让开发者不用再为对接问题头疼了。mcp.so如下图所示,这是 mcp.so 网站中的 MCP Server。使用百度/高德地图分析旅线计算时间接 Puppeteer 自动操作网页使用 Github/Gitlab 让大模型接管代码仓库。

悟空聊架构的专栏 1946

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

Arcgis 10.3 与 ArcGIS Engine 10.3 安装与破解

Arcgis 10.3 与 ArcGIS Engine 10.3 安装与破解

weixin_52127098的博客 4726

PTA甲级 1005 Spell It Right (C++)

Given a non-negative integer NNN, your task is to compute the sum of all the digits of NNN, 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)N

Misdirection 291

从FPGA工程师视角看CXP-12:如何用Xilinx GTX/GTH收发器搞定一条50Gbps的工业相机数据流?

本文从FPGA工程师视角详细解析了如何利用Xilinx GTX/GTH收发器实现50Gbps的CXP-12工业相机数据流传输。通过协议分析、硬件设计要点和FPGA逻辑实现,帮助开发者高效构建高带宽工业视觉系统,特别适合4K/8K高分辨率图像处理需求。

weixin_42533622的博客 282

从零到一:手把手教你用Python+LangChain搭建企业级RAG知识库(附避坑指南)

本文为开发者提供了一份详尽的实战指南,手把手教你使用Python和LangChain框架从零构建企业级RAG知识库。内容涵盖环境搭建、文档处理、向量化检索、提示工程及生产部署等核心环节,并重点分享了文档分割、检索优化等关键避坑经验,旨在帮助读者打造稳定、高效且易于维护的智能知识中枢。

weixin_29058331的博客 398

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

版本一(通过) # include <iostream> # include <vector> # include <unordered_map> using namespace std; unordered_map<char, string> mp = { {'1', "one" } , {'2', "two" } , {'3', "three"} , {'4', "four" } , {'5', "fi

MYMarcoreus的博客 299

Jlink除了调试还能干啥?用JFlash SPI给W25Q64烧录固件的5个实用技巧

本文深入探讨了Jlink的隐藏功能,特别是通过JFlash SPI高效烧录W25Q64的5个进阶技巧。从硬件连接优化到批量处理脚本,再到数据安全验证,这些技巧能显著提升烧录速度和稳定性,适用于量产环境。文章还提供了详细的参数配置和脚本示例,帮助工程师充分发挥Jlink的潜力。

weixin_29164843的博客 410

PAT 甲级 1005 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. Each case occupies one line which contains anN(≤10100). ...

qq_37637818的博客 545

基于STM32的半导体制冷片温度控制

制冷片温度控制,温控范围15℃~45℃,本人菜鸡一枚,大佬绕路。 #include "stm32f10x_gpio.h" #include "relay.h" void relay_Init(void){ GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);//Ê...

大白兔的博客 9016

华为昇腾910B3显卡实战:手把手教你部署DeepSeek 32B模型(含Bge-zh向量库配置)

本文详细介绍了在配备8张华为昇腾910B3显卡的服务器上,从零部署DeepSeek 32B大模型推理服务的完整实战方案。内容涵盖环境准备、模型配置、多卡负载分配,并集成了BGE中文向量模型与ChromaDB向量数据库,最终通过Open WebUI构建了可投入生产的企业级AI应用栈,为私有化大模型部署提供了具体参考。

weixin_29038345的博客 1710

PTA甲级考试真题练习5——1005 Spell It Right

题目 生词生句 non-negative integer 非负整数 思路 很简单的一题,先将遍历输入的字符串累加求和,然后将sum的每个位记录下来存入栈中,再出栈,出栈的同时输出对应的英文 代码 using namespace std; const char* str[10] = { "zero","one","two" ,"three" ,"four" ,"five" ,"six" ,"s...

醉等佳人归 191

完整内、外期货量化交易系统源码可售

支持客户登录校验,支持所有的实时行情和汇总报价功能、实时资讯(报价,列表,分时,分钟成交明晰,),多线程支持盘后收盘作业下载(日线,5分钟线,15分钟, 30分钟,60分钟线,),支持从服务器下载相关运行配置(来自服务器动态配置信息,如收盘日期等),实现状态条显示。收盘作业包括日线、5分钟线、15分钟线、30分钟、60分钟线、2小时线、4小时线每日分时走势。综合信息栏显示用户账户信息、合约信息、当日委托单记录、当日成交记录、当日平仓记录、当日跟单记录、当日(月/周)排行榜、下单栏、持仓信息;

qq_35600909的博客 1805

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

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

PAT A1005 Spell It Right (20)

PTA跳转:原题链接 这道题用到了栈,难度一般,题目大意是输入一个不大于10100的非负整数,计算各个数字之和,通过英文输出这个总和。(如输入"123456",由于"1+2+3+4+5+6=21",则输出"two one") 由于输入数据的范围较大( 0 ≤ x ≤ 10100 ),因此要用字符数组来存放输入数据,通过" ‘数字’-‘0’ “将字符型转变为整型(如” ‘7’-‘0’=7 ")。 累...

koori_145的博客 330

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

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

[PAT-Advanced] A1005 Spell It Right (20)

文章目录A1005 Spell It Right (20point(s))Input Specification:Output Specification:Sample Input:Sample Output:CodeAnalysis A1005 Spell It Right (20point(s)) Given a non-negative integer N, your task is to ...

Duke 223

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

PAT-A 1005 Spell It Right (20 分)

思路:还是使用sprintf将和转换为字符串的形式。

qq_38127801的博客 172

【PAT甲级A1005 】Spell It Right (20分)(c++)

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

小庄同学的博客 191

PAT A1005 Spell It Right (20 分)

1005 Spell It Right (20 分) Given a non-negative integer NNN, your task is to compute the sum of all the digits of NNN, and output every digit of the sum in English. Input Specification Each input file contains one test case. Each case occupies one line whi

一只小羊 562

PAT(A)1005 Spell It Right (20 分)

Sample Input: 12345 Sample Output: one five 思路: 字符串输入,然后直接遍历字符串,求出字符串转化为数字后,求出总和,然后打表输出值。 代码 #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #inclu...

Sqssq的博客 146

PAT A 1005 Spell It Right (20 分)

要点 - 整型转string: `str = to_string( int );` - string可以逐位遍历;

Siumai's Blog 136
上一篇: PAT-A 1004 Counting Leaves (30)
下一篇: PAT-A 1006 Sign In and Sign Out (25)
ShadowFox_
博客等级 码龄9年 5粉丝 60原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值