hdu 1057 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 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 -AASample Output
0
2C
11
-2C
-90
题意:
给两个16进制的数,计算两数和
代码如下:
#include<stdio.h>
int main(void)
{
__int64 a, b;
while(scanf("%I64x%I64X", &a, &b) != EOF)
printf(a+b<0?"-%I64X\n":"%I64X\n", a+b<0?-a-b:a+b);
return 0;
}
hdu 1057 A + B Again的更多相关文章
- HDU 1057 What Are You Talking About trie树 简单
http://acm.hdu.edu.cn/showproblem.php?pid=1075 题意 : 给一个单词表然后给一些单词,要求翻译单词表中有的单词,没有则直接输出原单词. 翻译文段部分get ...
- hdu 1057 (simulation, use sentinel to avoid boudary testing, use swap trick to avoid extra copy.) 分类: hdoj 2015-06-19 11:58 25人阅读 评论(0) 收藏
use sentinel to avoid boudary testing, use swap trick to avoid extra copy. original version #include ...
- HDU 1057 - A New Growth Industry
简单的模拟. 给定天数n,给定D[0]~D[15]给定一个20*20的矩阵.每个格子内有一个0~3的数字,表示细菌数.每天,每个格子将加上D[k],k表示这个格子以及上下左右相邻格子的细菌之和(矩阵外 ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- [转] HDU 题目分类
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...
- HDU ACM 题目分类
模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...
- HDU 5643 King's Game 打表
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
- hdu 分类
HDU分类 http://www.cnblogs.com/ACMan/archive/2012/05/26/2519550.html#2667329 努力A完.方便自己系统A题 不断更新中...... ...
随机推荐
- Linux中命令行终端切换工具screen
screen命令 本文转自:http://man.linuxde.net/screen Screen是一款由GNU计划开发的用于命令行终端切换的自由软件.用户可以通过该软件同时连接多个本地或远程的命令 ...
- Python操作Influxdb数据库
1.influxdb基本操作[root@test ~]# wget https://dl.influxdata.com/influxdb/releases/influxdb-1.2.4.x86_64. ...
- Vue.js简单的状态管理和 Vuex的几个核心概念使用。
由于状态零散地分布在许多组件和组件之间的交互中,大型应用复杂度也经常逐渐增长. 如果多层组件嵌套使用,传递prop,和事件emit.都很不方便. 不方便对数据的修改进行历史记录.影响后续的调试! 为了 ...
- centos 安装 和 linux 简单命令
1. centos 安装 参照:https://www.cnblogs.com/tiger666/articles/10259102.html 安装过程注意点: 1. 安装过程中的选择安装Basic ...
- php匹配页面中的所有路径
方法一 $url='http://www.google.cn/search?q=php'; $html=file_get_contents($url); $dom = new DOMDocument( ...
- Financiers Game CodeForces - 737D (博弈论)
直接暴力区间DP的话是$O(n^3)$, 关键注意到每步走的距离差不超过1, 所以差最大是$O(\sqrt{n})$的, 所以实际上有用的状态是$O(n^2)$的, 可以通过.
- Kubernetes DNS 高阶指南(转发别人 解析很详细)
转发地址:http://www.jintiankansha.me/t/Js1R84GGAl DNS 是 Kubernetes 的核心功能之一,Kubernetes 通过 kube-dns 或 Cor ...
- 【IDEA】【1】准备工作
1,官方网址(https://www.jetbrains.com/idea/) 2,网盘地址(为ideaIU-2018.2.5) 链接:https://pan.baidu.com/s/1oLgY_Pb ...
- csu oj 1342: Double
Description 有一个由M个整数组成的序列,每次从中随机取一个数(序列中每个数被选到的概率是相等的)累加,一共取N次,最后结果能被3整除的概率是多少? Input 输入包含多组数据. ...
- 安装sql 2008步骤以及所遇到的问题
下载网址:http://www.xiazaiba.com/html/4610.html 安装步骤: 1. 在Windows7操作系统系,启动Microsoft SQL 2008安装程序后,系统兼容性 ...