2057 A + B Again
|
A + B AgainTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15391 Accepted Submission(s): 6713Problem 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
Sample Output
思路:当时写的时候,想的是把16进制转化为10进制,相加后再转化为16进制,感觉比较麻烦 就查了网上的博客,才发现16进制也可以加减,就是不能输出正负好,就设置了一个字符c来
控制正负,注意printf("%x\n",sum);和printf(“%X\n",sum);在这道题上是有区别的;刚开始就把
“X"写成"x",一直提交说答案错误!!!正确代码如下
#include<stdio.h> |
2057 A + B Again的更多相关文章
- 扩展欧几里德算法 cogs.tk 2057. [ZLXOI2015]殉国
2057. [ZLXOI2015]殉国 ★☆ 输入文件:BlackHawk.in 输出文件:BlackHawk.out 评测插件时间限制:0.05 s 内存限制:256 MB [题目描 ...
- hdu 2057 A+B
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2057 For each test case,print the sum of A and B in h ...
- hdu 2057 A+B Again
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2057 题目分析:涉及到16进制内的加法,可以用%I64x直接来处理,要注意到16进制中负数是用补码来表 ...
- HDU 2057 十六进制加减法
http://acm.hdu.edu.cn/showproblem.php?pid=2057 水题,%I64X 长整形十六进制输入输出 #include<stdio.h> in ...
- AC日记——#2057. 「TJOI / HEOI2016」游戏 LOJ
#2057. 「TJOI / HEOI2016」游戏 思路: 最大流: 代码: #include <cstdio> #include <cstring> #include &l ...
- poj 2057 树形DP,数学期望
题目链接:http://poj.org/problem?id=2057 题意:有一只蜗牛爬上树睡着之后从树上掉下来,发现后面的"房子"却丢在了树上面, 现在这只蜗牛要求寻找它的房子 ...
- 杭电oj2081、2091、1004、2057
2081 手机短号 #include<stdio.h> #include<string.h> int main(){ int i,n; ]; while(scanf(&quo ...
- FZU 2057 家谱(dfs)
Problem 2057 家谱 Accept: 129 Submit: 356Time Limit: 1000 mSec Memory Limit : 32768 KB Problem ...
- cogs 2057. [ZLXOI2015]殉国
2057. [ZLXOI2015]殉国 ★☆ 输入文件:BlackHawk.in 输出文件:BlackHawk.out 评测插件时间限制:0.05 s 内存限制:256 MB [题目描 ...
- 题解报告:hdu 2057 A + B Again
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2057 问题描述 我们的HDOJ必须有许多A + B问题,现在又有新的问题出现. 给你两个十六进制整数, ...
随机推荐
- 5.4.3 RegExp构造函数属性
RegExp构造函数包含一些属性(这些属性在其他语言中被看成是静态属性).这些属性适用于作用域中的所有正则表达式,并且基于所执行的最近一次正则表达式操作而变化.关于这些属性的另一个独特之处,就是可以通 ...
- [LeetCode]题解:005-Longest Palindromic Substring优化
题目来源和题意分析: 详情请看我的博客:http://www.cnblogs.com/chruny/p/4791078.html 题目思路: 我上一篇博客解决这个问题的时间复杂度是最坏情况是(O(n^ ...
- python的内置函数bin()
bin(x) 中文说明:将整数x转换为二进制字符串,如果x不为Python中int类型,x必须包含方法__index__()并且返回值为integer: 参数x:整数或者包含__index__()方法 ...
- 在VPS上安裝BT軟體Transmission
在VPS上安裝BT軟體Transmission 作者: 窮苦人家的小孩 | 2009-12-04 55 Comments VPS 還能怎玩?! 裝Proxy,裝VPN,這還不夠,我還用來掛種子 ...
- [转]WIBKIT技术资料
WebKit结构和流程分析 http://inedx.blog.hexun.com/28830354_d.html webkit架构 http://inedx.blog.hexun.com/28795 ...
- 简单字符串模式匹配算法的C++实现
/* * simpleIndex.cpp * Author: Qiang Xiao * Time: 2015-07-13 */ #include<iostream> #include< ...
- java源代码如何打成jar包
链接地址:http://jingyan.baidu.com/article/046a7b3ed8b23ef9c27fa9b9.html 有时自已写了一个很巧妙的方法,想分享给别人用,这时我们就可以将其 ...
- [置顶] P2P之我见,关于打洞的学问-------开篇
最近忙项目,有点累,无暇顾急博客,4月份本来想写写流媒体的文章,结果回家休了两个月回深圳后,接了P2P的项目,那就开始P2P吧. P2P起源于美国大学生Shawn Fanning 写的一个分享软件Na ...
- 漏网之鱼--HTML&CSS
一.HTML <meta>标签使用该标签描述网页的具体摘要信息,包括文档内容类型,字符编码信息,搜索关键字,网站提供的功能和服务的详细描述等.<meta>标签描述的内容并不显示 ...
- selenium 怎么处理display:none
页面HTML是这样的: .... <div class="cf w index-middle"> <div id="li" class=&q ...