hdu_problem_2057_A + B Again

A + B Again 杭电oj 2056 十六进制 Problem Description There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too. Easy ? AC it ! Input The input contains several t 阅读详情

题目大意:输入两个16进制数,输出相加的结果

/*
*
*Problem Description
*There must be many A + B problems in our HDOJ , now a new one is coming.
*Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too.
*Easy ? AC it !
*
*
*Input
*The input contains several test cases, please process to the end of the file.
*Each case consists of two hexadecimal integers A and B in a line seperated by a blank.
*The length of A and B is less than 15.
*
*
*Output
*For each test case,print the sum of A and B in hexadecimal in one line.
*
*
*Sample Input
*+A -A
*+1A 12
*1A -9
*-1A -12
*1A -AA
*
*
*Sample Output
*0
*2C
*11
*-2C
*-90
*
*
*Author
*linle
*
*
*Source
*校庆杯Warm Up
*
*
*Recommend
*linle
*
*/
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
long long a, b;
int length;
long long htod(string s) {
 long long temp(0);
 length = s.size();
 for (int i = s.size() - 1; i >= 0; --i) {
  if ('A' <= s.at(i) && s.at(i) <= 'Z') {
   temp += (s.at(i) - 'A' + 10)*pow(16, length - i - 1);
  }
  else if (s.at(i) == '-') {
   temp = -temp;
  }
  else if (s.at(i) == '+') {
   continue;
  }
  else {
   temp += (s.at(i) - '0')*pow(16, length - i - 1);
  }
 }
 return temp;
}
int main() {
 string A, B;
 while (cin >> A >> B) {
  a = htod(A);
  b = htod(B);
  if (a + b >= 0)
   printf("%llX\n", a + b);
  else
   printf("-%llX\n",-(a + b));
 }
 system("pause");
 return 0;
}
Mac用户必看:Parallels Desktop 18.1.1最新破解版安装与优化全攻略(附资源) 本文为Mac用户提供Parallels Desktop 18.1.1的详细安装与优化指南,涵盖虚拟化技术选型、专业级配置流程及性能调优技巧。重点解析Parallels Desktop在图形加速、系统资源调度方面的核心优势,并分享生产力增强技巧与典型应用场景实战方案,帮助用户最大化利用这一高效虚拟化工具。 阅读详情

相关推荐

AirSim安装和地图加载

详细教程如何安装AirSim并加载地图

fegxg的博客 3035

A + B Again(十六进制的输入与输出)

Problem Description There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal...

qq_43118572的博客 594

Qt跨平台CAN通信实战:Vector、PCAN与周立功设备统一接口设计

本文针对Qt开发中常见的多品牌CAN设备兼容难题,提出了一套统一的跨平台CAN通信接口设计方案。通过抽象层封装,实现了对Vector、PCAN和周立功设备的统一操作,上层业务代码无需修改即可在不同硬件间切换,有效解决了驱动API差异、环境配置复杂和维护成本高等痛点,显著提升了代码复用率和开发效率。

weixin_29161785的博客 334

HDOJ 2057 A + B Again(水题,基础)

http://acm.hdu.edu.cn/showproblem.php?pid=2057 A + B Again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 23442    Accepted Submission(

Shyazhut 725

【Web攻防】SQLMap实战进阶:从数据猜解到高权限渗透的全流程指南

本文介绍了SQLMap工具在Web安全渗透测试中的实战应用,重点讲解了数据猜解、高权限操作、复杂请求提交、Tamper脚本开发和指纹绕过等核心场景。文章提供了可直接复用的命令示例,包括数据库信息获取、文件读写、命令执行等操作,并详细说明了POST/JSON/Cookie注入的实现方法。同时,介绍了Tamper脚本的开发模板和指纹伪装技巧,帮助降低检测风险。最后强调SQLMap在自动化渗透全链路中的价值,从漏洞发现到权限提升的完整流程,并提供了优化测试效率的实用建议。所有技术内容仅限合法授权场景使用。

YsChunQiu777的博客 443

C# WinForms实战:5分钟用ScottPlot打造专业级示波器界面(附完整代码)

本文详细介绍了如何在C# WinForms应用中,利用ScottPlot.WinForms库快速构建一个专业级的软件示波器界面。通过从环境配置、静态波形绘制到动态数据实时更新的完整实战演示,帮助开发者高效实现高性能的波形显示功能,适用于工业监控、信号分析等多种场景。

weixin_29198045的博客 831

HDOJ 2057 A + B Again

 A + B Again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 19352    Accepted Submission(s): 8358 Problem Description There must

Chunzhen的博客 791

ESP32S3 Korvo2V3四通道AEC配置实战:基于AFE的回声消除优化

本文详细介绍了在ESP32S3 Korvo2V3平台上配置四通道AEC(回声消除)的实战经验。通过AFE算法优化和硬件连接调试,实现高质量回声消除,显著提升智能音箱和会议设备的语音交互体验。重点解析了四通道配置、数据格式对齐和参数调优等关键技术要点。

elastic6hunter的博客 940

A + B Again

A + B Again There must be many A + B problems in our HDOJ , now a new one is coming.  Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too.  E...

Move on 304

课堂练习及课后作业2.1:外部中断

本关任务:通过相关知识以及实验回答:版本 1 内核的第 6 次时钟中断发生时,断点和恢复点(指令地址)分别是多少?本关任务:修改版本 0 内核,使得每发生 100 次时钟中断,就在屏幕上输出一个字符‘t’和当时的进程号,如“t(0)”表示0号进程运行时发生了时钟中断。本关任务:通过实际操作回答在输出第一行 0/1 字符的过程中(如下图所示),共发生了几次时钟中断?本关任务:修改版本 1 内核源码,使得每次时钟中断发生时,都在屏幕上输出字符‘t’。分析版本1内核,找到第一次时钟中断的恢复点地址。

Junds0的博客 1万+

AMD KFD的SDMA Packet 类型和定义解析

本文详细分析了AMD GPU架构中的SDMA(System Direct Memory Access)数据传输机制,重点介绍了其核心数据结构——SDMA Packet。SDMA通过8种主要Packet类型(包括内存拷贝、数据写入、屏障同步、中断触发等)实现高效主机-设备通信。每种Packet采用位域结构和联合体封装设计,在保证功能完整性的同时实现空间优化。这些Packet支持丰富的访问属性和扩展字段,适用于高性能数据搬运、内存初始化、任务同步、性能分析等场景,为GPU计算提供了灵活高效的数据传输解决方案。

图形/计算GPU的驱动与虚拟化技术分享园地 1256

HDOJ2057_A + B Again

链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2057 /*public long nextLong(int radix)将输入的下一个标记扫描为long 。 * 如果下一个令牌不能转换为有效的长值,则此方法将抛出InputMismatchException , * 如下所述。 如果翻译成功,扫描仪将超过匹配的输入。 *

BarryLee的博客 334

剪映专业版关键帧完全教程:从原理到实战的动画必修课

关键帧是视频动画的核心原理。视频由连续静止画面(帧)构成,关键帧记录素材属性变化的起始与结束状态,中间过渡帧由软件自动计算生成。剪映专业版中,视频、音频、文本、贴纸等素材均支持关键帧动画,可调节位置、缩放、旋转、不透明度、音量等参数。操作为:在起始位置点击参数旁菱形按钮添加关键帧,移动播放头后调整参数,系统自动生成第二个关键帧。多属性可独立控制并叠加,实现放大同时淡出等复合效果。通过设定变化起点与终点,关键帧能让静止元素产生移动、缩放、淡入淡出等丰富动态,是视频剪辑从基础拼接进阶创意表达的核心技能。掌握关键

深耕计算机专业知识与技术。 2093

A + B Again 2周练3

Problem Description There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal t...

Zoran的博客 174

老版QQ原生表情gif动态

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

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

HDU 2055 An easy problem

3

Shyazhut 308

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

HDU 6319 Problem A. Ascending Rating(单调队列详解)

题目链接 Problem A. Ascending Rating Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 2057Accepted Submission(s): 622 Problem Descriptio...

咸鱼有梦想 288

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

HDU 6319 Problem A. Ascending Rating (单调队列+经验细节)

Problem A. Ascending Rating Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 2057    Accepted Submission(s): 622   Problem De...

满月照亮的路 283

杭电ACM基础题(2048、2049、2053、2055、2056、2057、2060、2061、2071、2073)

文章目录2048、抽奖活动无人中奖的概率[错排问题]2049、不容易系列之(4)——考新郎[错排问题]2053、Switch Game[开关灯]2055、An easy problem[计算n+f(c)]2056、Rectangles[计算重叠部分矩形面积] 2048、抽奖活动无人中奖的概率[错排问题] HDU 2006’10 ACM contest的颁奖晚会隆重开始了! 为了活跃气氛,组织者举行...

柠檬超级酸 5025

hdu 2057 A + B Again

A + B Again Problem Description There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it i...

迷路的博客 213

第四次—C - A + B Again

C - A + B Again There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too. Easy ? AC it ! Input The input contains several test cas

C i C i 252

hdu2057题解

hdu2057 :A+B again(基础的进制处理) 题目: There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too. Easy ? AC it ! INPUT The input contains

weixin_53075909的博客 388

HDU1867:A + B for you again

Problem Description Generally speaking, there are a lot of problems about strings processing. Now you encounter another such problem. If you get two strings, such as “asdf” and “sdfg”, the result of

ACM!荣耀之路! 2382

hdu A + B for you again

A + B for you again Time Limit : 5000/1000ms (Java/Other)Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 3Accepted Submission(s) : 1 Problem Description Generally speaking, th...

weixin_30633405的博客 189

HDU 2057 A + B Again

A + B Again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 14906    Accepted Submission(s): 6491 Problem Description There must be

Infino_coder 465

D - A + B for you again

Generally speaking, there are a lot of problems about strings processing. Now you encounter another such problem. If you get two strings, such as “asdf” and “sdfg”, the result of the addition between

ACM77的博客 902
上一篇: hdu_problem_2056_ Rectangles
下一篇: hdu_problem_2058_The sum problem
CoderZhuuu
博客等级 码龄10年 26粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值