第四次—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 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

思路

%d 有符号32位整数
%u 无符号32位整数
%lld 有符号64位整数

%llx有符号64位16进制整数
X输出大写字母,x输出小写字母

代码

#include<stdio.h>
int main(){
	long long a,b,sum;
	while(scanf("%llX%llX",&a,&b)!=EOF){
		sum=a+b;
		if(sum<0) printf("-%llX\n",-sum);
		else printf("%llX\n",sum);
	}
	return 0;
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Programming Python, 2nd Edition 目录如下,需要下载的朋友不要错过哦~ Programming Python, 2nd Edition By Mark Lutz Publisher : O'Reilly Pub Date : March 2001 ISBN : 0-596-00085-5 Pages : 1256 Copyright Foreword Preface "And Now for Something Completely Different . . . Again" Signs of the Python Times Why This Edition? Major Changes in This Edition Using the Examples and Demos Conventions Used in This Book Where to Look for Updates Contacting O'Reilly Acknowledgments Chapter 1. Introducing Python Section 1.1. "And Now for Something Completely Different" Section 1.2. The Life of Python Section 1.3. The Compulsory Features List Section 1.4. What's Python Good For? Section 1.5. What's Python Not Good For? Part I: System Interfaces Chapter 2. System Tools Section 2.1. "The os.path to Knowledge" Section 2.2. Why Python Here? Section 2.3. System Scripting Overview Section 2.4. The sys Module Section 2.5. The os Module Section 2.6. Script Execution Context Section 2.7. Current Working Directory Section 2.8. Command-Line Arguments Section 2.9. Shell Environment Variables Section 2.10. Standard Streams Section 2.11. File Tools Section 2.12. Directory Tools Chapter 3. Parallel System Tools Section 3.1. "Telling the Monkeys What to Do" Section 3.2. Forking Processes Section 3.3. Threads Section 3.4. Program Exits Section 3.5. Interprocess Communication Section 3.6. Pipes Section 3.7. Signals Section 3.8. Launching Programs on Windows Section 3.9. Other System Tools Chapter 4. Larger System Examples I Section 4.1. "Splits and Joins and Alien Invasions"

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值