pat1001A+B Format (20)

电力电子技术进阶:从基础到实战的完整学习路径 本文系统阐述了电力电子技术从基础到实战的完整学习路径。首先解析了电力电子作为“电能魔术师”的核心作用,随后深入剖析了数学工具、电路电磁场与半导体器件三大基础支柱。文章重点讲解了DC-DC、DC-AC、AC-DC等核心变换拓扑,并探讨了从经典PID到现代模型预测控制(MPC)的控制策略。最后,分享了硬件设计、软件调试、电磁兼容(EMC)等实战经验与前沿趋势,为学习者提供了清晰的进阶指南。 阅读详情

题意分析:

(1)输入两个普通整数a,b([-1000000,1000000]),把它们的和按照三位一个逗号来分割输出。

(2)因为最终是对结果的整数进行分割加入字符,直接采用取模运算的话,需要开辟一个数组空间来按顺序存取模后的值,最后逆序处理,或者按照递归的思路,如整除1000后不为0,再以num/1000为参数进入下一层递归,直至为0的时候退出递归栈,但是这样会带来一个问题:每次取模后的数不一定都是三位,因此在最后处理输出的时候,还要处理前导0(第一个前三位不需要处理前导0)。

(3)综合来看,因为运算数不大,运算结果范围也不大,直接采用字符数组逆序存结果的每一位,然后统计结果位数为3的整数倍时,便插入一个逗号,最后再逆序输出。

可能坑点:

(1)第一位的前面和最后一位的后面不加逗号

(2)处理前要注意结果的正负,建议统一按正数处理

(3)结果为0的时候需要单独处理

#include <iostream>
using namespace std;
char res[10];
int main()
{
    int a,b,c;
    cin>>a>>b;
    c=a+b;
    int flag=0;
    if(c<0){
        flag=1;
        c=-c;
    }
    if(c==0)cout<<0<<endl;
    int i=0,count=0;
    while(c/10!=0){
        res[i++]=c%10+'0';
        count++;
        if(count%3==0)res[i++]=',';
        c=c/10;
    }
    if(c!=0)res[i]=c%10+'0';
    if(flag)cout<<"-";
    for(int j=i;j>=0;j--){
        cout<<res[j];
    }
    cout<<endl;
    return 0;
}


nvidia系列教程-AGX-Orin usb3.0接口调试 NVIDIA Jetson AGX Orin 是一款高性能的嵌入式计算平台,适用于 AI 推理、机器人、自动驾驶等应用场景。本文将介绍如何对 AGX Orin 平台上的 USB 3.0 接口进行调试,包括硬件检查、软件配置以及常见问题的排查。本文主要介绍在AGX-Orin平台开启两个usb3.0口的方法。通过以上步骤,您可以有效地调试和优化 NVIDIA Jetson AGX Orin 上的 USB 3.0 接口。 阅读详情

相关推荐

Hive数据迁移

【迁移背景】 本次需要将老集群的hive数据(共30多张表)迁移至新集群中。 老集群版本为CDH5.13,未启用kerberos; 新集群版本为CDH5.14,启用了kerberos。 由于cloudera官方文档说明,在5.x的版本不支持从未启用kerberos的集群与启用了kerberos的集群之间的数据复制。因此无法通过bdr方式进行数据同步。于是采用手工方式进行测试验证。 第一步...

wangkuangood3200的专栏 469

PAT(Advanced Level)1001 A+B Format

1001 A+B Format (20 分) 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). Input Spe...

金州饿霸吃不饱的博客 360

速腾RS-LiDAR-16激光雷达ROS配置全攻略:从硬件连接到Rviz点云可视化

本文详细介绍了速腾RS-LiDAR-16激光雷达在ROS环境中的配置与使用全攻略,涵盖硬件连接、网络配置、ROS驱动安装及Rviz点云可视化等关键步骤。通过实战案例和技术解析,帮助开发者快速实现激光雷达数据采集与处理,提升机器人感知系统的部署效率。

ooo22的博客 249

PAT甲级 1001. A+B Format (20)--两种方法

题目链接:https://www.patest.cn/contests/pat-a-practise/1001 1001. A+B Format (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 C

话歪之地的博客 8322

android广告SDK原理详解(附源码)

广大的开发者吃糠咽菜开发了一两款APP,获取了一些流量后自然就会想到流量变现,一般情况下大家会选择到百度联盟或者Google Admob这些广告服务提供商注册开发者账号,在自己的APP里面加上几行广告位代码,集成他们的广告SDK包。然后谋事在人,成事在天,只有每天看报表查查收益。   也有一些开发者为了能够提高自己的变现水平,同时接入了好几家的sdk,哪家出的收益高一点我就出哪家的广告,但是这

rmcgogo的博客 1万+

论文阅读笔记:Extended Vision Transformer (ExViT) for Land Use and Land Cover Classification

注意力机制驱动的深度模型最近取得了成功,如最具代表性的视觉转换器(ViT),吸引了一波高级研究来探索它们对更广泛领域的适应。然而,遥感(RS)领域中基于Transformer的方法更关注单模态数据,这可能会在充分利用不断增长的多模态地球观测数据时失去可扩展性。为此,我们提出了一种新的多模式深度学习框架,通过在最小修改的情况下扩展传统的ViT,针对土地利用和土地覆盖(LULC)分类任务。

嗑研狗的日常 945

PAT 1001 A+B Format (20 分) ——甲级

#include<iostream> #include<string> using namespace std; int main(){ int a, b, c; scanf("%d %d", &a, &b); c = a + b; if(c < 0){ c = -1 * c; printf("-"); } string str1...

RickLin_的博客 155

基于STM32的太阳能充电宝设计_资料编号31

系统硬件包括主控 STM32F103C8T6、0.96 OLED 显示屏、蜂鸣器、电源自锁开关、温度传感器 DS18B20、继电器、5 V DC 升压模块 、TB4056、18650锂电池、9 V太阳能板、稳压降压 5 V三极管。电源供应:锂电池为系统供电,9 伏太阳能板经 5 伏降压稳压三极管降压为 5 伏后传送到 TP4056,TP4056 为锂电池供电,因锂电池电压 3.7 伏,通过 5 伏 DC 升压模块升压到 5 伏为整个系统提供 5 伏电压。

嵌入式阿齐Archie 1万+

PAT 甲级 1001 1001 A+B Format (20 分) 我的解法+别人的解法

原PAT网站用户可在 https://patest.cn/bind_old_pat_user 页面绑定至拼题A账号。绑定后,原PAT网站的提交将被合并至拼题A网站用户的对应题目集中。 返回 1001 A+B Format (20 分) Calculate a+b and output the sum in standard format -- that is, the digits m...

小渣渣的博客 853

使用CiteSpace软件对知网文献进行关键词共现/聚类/突现分析

一、基本概念CiteSpace(引文空间)是一款专注于分析科学分析中蕴含的潜在知识的软件。它是在科学计量学、数据可视化背景下逐渐发展起来的引文可视化分析软件。通过可视化的手段,CiteSpace能够呈现科学知识的结构、规律和分布情况,并因此将这种分析得到的可视化图形称为“科学知识图谱”。二、主要功能和用途知识图谱构建:根据科学文献的引用关系,CiteSpace可以生成知识图谱,帮助研究人员更好地理解学术领域中不同文献之间的联系和演化过程。主题聚类分析。

m0_64336780的博客 1万+

uniapp - web-view嵌套H5网页白屏问题,<web-view>页面跳转出现白屏情况,强力解决uniapp嵌套webview页面时出现无法加载并白屏(无论本地还是线上H5网页链接都能解决)

uniapp微信小程序,uniapp APP端,uni-app web-view嵌套H5项目白屏问题分析及解决,uniapp嵌套webview页面时,出现白屏,uniapp <web-view>页面跳转出现白屏解决方法,uniapp <web-view>页面跳转出现白屏解决方法,解决uniapp的web-view打开网页在老手机上出现白屏的问题,uni-app web-view白屏处理,引入本地网页白屏,WebView 加载不出网页,一片空白webview白屏加载不出来,使用webview加载链接后白屏,u

🏆 前端领域优质创作者 1万+

PAT 甲级 1001 A+B Format (20 分)

题目:PAT 甲级 1001 A+B Format (20 分) 经验总结: 两数之和的结果有三种可能:正数、0、负数。特别要注意0的情况,不要忽视了。 解法一(数字转字符串处理):首先将数字结果转换成字符串,判断是否是负数,是负数就先把负号输出,然后去掉负号再对剩下的数字做判断。如果要输出逗号,那么这个逗号的前面必须且至少有个数字。所以可以遍历字符串,输出当前字符后,判断从当前字符开始到...

努力努力再努力 280

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

PAT甲级 A1001. A+B Format (20)

1001 A+B Format (20分) 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). Input Specification: Each input file contains one test case. Each cas

weixin_43977129的博客 320

jre9下载 jdk9

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

VB摄像头监控

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

PAT甲级 1001 A+B Format (20 分)

1001 A+B Format (20 分) 题目链接PAT A 1001 思路分析:这道题用字符串去解决可能比较方便,用到了C++11特性里的to_string函数,可以直接将数字转换为字符串。坑点就是它是从个位开始每三位加一个逗号,我一开始还傻乎乎的以为是从最高位。。。 AC代码: #include<iostream> using namespace std; int main(...

weixin_43684054的博客 213

精雕软件(JDpaint) 5.5 绿色版

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

[PAT-Advanced] A1001 A+B Format (20)

PAT甲级A1001题目+分析+题解

Duke 424

PAT甲级 1001 A+B Format (20分)

1001 A+B Format (20分) 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). Input Specifi...

ganlanA的博客 209

PAT 1001 A+B Format (20 分)

1001 A+B Format (20 分) 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). Input Specif...

qq_40773319的博客 244

[PAT] 1001 A+B Format (20 分)Java

1001 A+B Format (20 分) 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)....

Simma1101的博客 209

PAT甲级——1001 A+B Format (20分)

PAT甲级——1001 A+B Format (20分) 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). Input Specification: Each input file contains one test case. E

linjiayina的博客 191

PAT甲级1001 A+B Format (20分)

#PAT甲级1001 A+B Format (20分) 题目: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). Inpu...

weixin_43795683的博客 388

【JAVA】1001 A+B Format (20分) PAT甲级 PAT (Advanced Level) Practice

目录1001 A+B Format (20分)思路一:不按他们的位数分情况处理代码一:用可变数组ArrayList+字符串截取方法subString代码二:栈Stack+字符串截取方法subString思路二:因为a和b的范围较小,所以可以按他们的位数分情况处理代码一:字符串截取方法substring代码二:StringBuilder的insert方法代码三:格式化输出 printf 1001 A...

子浩的博客 1万+

[PAT 甲级] 1001 A+B Format (20 分)

1001 A+B Format (20 分) 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). Input Specif...

cp0328的博客 3390

[C++]PAT 1001 A+B Format (20分)

Calculate a+ba + ba+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). Input Specification: Each ...

快乐de约定的博客 2092

PAT:A1001 A+B Format (20 分)

PAT:A1001 A+B Format (20 分) 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). Inpu...

Ecloss 446

PAT A1001 A+B Format (20分)

1001 A+B Format (20分) 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). Input Specification: Each input file contains one test case. Each cas

weixin_45964844的博客 190
下一篇: pat1002A+B for Polynomials (25)
LostStephon
博客等级 码龄11年 14粉丝 59原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值