PAT1005 Spell It Right

嵌入式系统开发笔记112:通过有人云测试MQTT 项目中使用到“有人”公司的WH-LTE-7S0模块,本文讲解通过有人云进行MQTT测试的方法。 阅读详情

题解

原题链接

这题比较简单,字符串输入,然后每一项求和,求和结果一定在1000以内就分别讨论然后switch case输出对应英文字母就可以了

AC代码

#include <iostream>
#include <cstdio>

using namespace std;

void print(int a);

int main()
{
    string s;
    int cnt=0;
    cin >> s;
    for (int i=0; i<s.length(); i++)
        cnt += int(s[i]-'0');
    if(cnt<10)
        print(cnt);
    else if (cnt<100)
    {
        print(cnt/10);
        printf(" ");
        print(cnt%10);
    }
    else
    {
        print(cnt/100);
        printf(" ");
        print((cnt%100)/10);
        printf(" ");
        print(cnt%10);
    }
    return 0;
}

void print(int a)
{
    switch(a)
    {
        case 0: printf("zero");break;
        case 1: printf("one");break;
        case 2: printf("two");break;
        case 3: printf("three");break;
        case 4: printf("four");break;
        case 5: printf("five");break;
        case 6: printf("six");break;
        case 7: printf("seven");break;
        case 8: printf("eight");break;
        case 9: printf("nine");break;
        default: break;
    }
}

end

OpenCV-Python实战(10)——详解 OpenCV 轮廓检测 在计算机视觉领域,轮廓通常指图像中对象边界的一系列点。因此,轮廓通常描述了对象边界的关键信息,包含了有关对象形状的主要信息,该信息可用于形状分析与对象检测和识别。在本文中,将首次通过简单示例了解轮廓的基本概念,然后通过实际示例来了解如何检测和压缩轮廓,最后利用介绍如何利用图像矩描述检测到的轮廓属性。 阅读详情

相关推荐

Cortex-M内核DWT周期计数器:从原理到STM32实战时间测量与性能分析

在嵌入式开发中,代码执行耗时测量是性能优化的基础。除了依赖外设定时器或SysTick,ARM Cortex-M3/M4/M7内核自带的DWT(Data Watchpoint and Tracker)调试组件提供了一种极低侵入性的硬件计时方案。其内部的32位周期计数器CYCCNT跟随内核时钟递增,无需占用额外引脚或定时器资源,即可实现纳秒级分辨率的函数耗时测量、中断响应分析及延时实现。从DWT寄存器配置、周期差值计算到基于SystemCoreClock的微秒换算,开发者可以快速搭建一套轻量级性能分析工具。本文

weixin_34216614的博客 208

PAT (Advanced Level) Practice 1001 A+B Format

Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).

XMD20030525的博客 1677

0/1背包问题:从暴力递归到动态规划详解

题目: 有一组数量为 n 个物品,每个物品都有重量w 和价值v 给定一个背包bag,背包装的物品不能超过背包最大载重容量返回背包bag 能装下的最大价值1. 物品的重量和价值:2. 背包的容量:暴力解法的核心是递归,通过逐一决策每个物品是否放入背包,最终找到最优解。状态定义:递归逻辑:递归终止条件: 动态规划解法 递归的暴力解法有重复子问题,导致了大量的重复计算。为了解决这个问题,我们可以使用动态规划来优化。状态定义:状态转移:边界条件: 测试方法 示例解析 假设:我们希望找到在容量为

Mr.Ayao's blog 2071

PAT ( Advanced Level ) Practice——攒够一波

exponents 指数 coefficients 系数 polynomials 多项式 // 1001 #include<iostream> #include<cstdio> #include<cstdlib> using namespace std; int main() { int a, b; cin>>a>>b; int ans = a + b; int f = 0; if (ans == 0) { cout<&l.

Coco_T的博客 1140

【β-Boltzmann探索策略】

𝜀是一个介于0和1之间的参数,用于控制探索和利用的比例。当𝜀较大时,智能体更倾向于探索;当𝜀较小时,智能体更倾向于利用已知信息。

m0_59385870的博客 1091

用Python进行GEO数据挖掘(学习笔记四):富集分析

该笔记详细解释了富集分析的工作原理,并简要地利用gseapy在python中进行富集分析的操作。

m0_64111502的博客 5651

PAT (Advanced Level) Practice

1003Emergency 最短路径问题——Dijkstra算法 选出最近的点,把该点加入集合 计算从该点出发到其他所有点的距离(排除集合中的点) 更新距离,救援队数量和路径数量,⚠️注意dis[now] + mmap[now][j] == dis[j]的情况 #include<bits/stdc++.h> using namespace std; #define inf 0x3f3f3f int n, m, s, e; int team[1000]; int mmap[1000][1000]

PickCake的博客 210

风力发电机缺陷检测平台

风力发电机缺陷检测平台相关内容展示

weixin_39779415的博客 1114

PAT甲级(Advanced Level) Practice 1008 Elevator

3 2 3 141。

2301_78006009的博客 581

Transformer时序预测避坑指南:TFT在风电场的5个实战经验

本文分享了Temporal Fusion Transformer在风电场功率预测中的五个实战经验,涵盖数据预处理、模型调优、显存优化、注意力机制解读及在线部署。针对风电数据噪声大、概念漂移等挑战,提供了从构建数据质量标签到高效超参调优的具体方案,并强调利用Transformer架构的可解释性进行业务洞察,助力实现稳健的工业级时序预测。

bert9linguist的博客 468

5分钟搞懂MSDNet:用Transformer实现小样本语义分割的保姆级教程

本文详细介绍了MSDNet(Multi-Scale Decoder Network)如何利用Transformer架构实现小样本语义分割。通过多尺度解码器和空间Transformer解码器,MSDNet能够在仅有1-5张标注图像的情况下完成精确分割任务。文章提供了PyTorch代码实例和优化技巧,帮助开发者快速掌握这一前沿技术。

weixin_30832143的博客 510

PAT (Advanced Level) Practice 题目集合(1051 ~ 1100)

1051 Pop Sequence (25 分) #include<bits/stdc++.h> using namespace std; const int N = 1e5+10; int n, m, k; int a[N], b[N]; int main() { cin >> m >> n >> k; for (int i = 1;i <= n;i ++) a[i] = i; while (k --) { stack <int&gt

LJR的博客 5258

Advanced Installer打包避坑指南:如何正确配置64位系统下的Java环境与注册表条件(以15.7版本为例)

本文详细解析了使用Advanced Installer 15.7版本在64位系统下打包Java应用时的常见问题与解决方案。重点介绍了注册表重定向机制、Java环境检测的双保险策略、环境变量设置的隐藏坑以及权限管理的进阶技巧,帮助开发者避免安装包在用户机器上无法运行的幽灵问题。

weixin_28676289的博客 332

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

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

Newin2020的博客 726

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

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

苏苏和柚子 143

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

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

SAP B1中文培訓教材_SDK

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

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

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

qq_35624947的博客 457

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的博客 138

1005 Spell It Right——PAT甲级

【代码】1005 Spell It Right——PAT甲级。

flyidj的博客 361

PAT 甲级 1005  Spell It Right

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

漫浸天空的雨色的备忘录~ 855

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

旺崽的博客 2908

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 line which

Jasonare的博客 760

【随手记_PAT甲级踩坑记】1005 Spell It Right

PAT甲级 A1005 Spell It Right 随手记录,只希望能帮助到同样遇到问题的小伙伴呀~ 还是学生,水平有限,写的不好的地方有请指正~ 这题没什么东西,只是需要注意在输入0的时候应该输出为zero 先上代码~ 代码 #include<iostream> #include<string> #include<stack> using namespace std; int main() { char t; int res = 0; string word[1

SpongeBob_wow的博客 671

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的博客 9558

[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

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

字符串基础题

thexiaosi的博客 334
上一篇: PAT甲级 1004 Counting Leaves——并查集应用
下一篇: PAT 1006 Sign In and Sign Out
adventural
博客等级 码龄9年 9粉丝 40原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值