HDU 2057 A + B Again(16进制加法)

网友投稿 1005 2022-08-23

HDU 2057 A + B Again(16进制加法)

HDU 2057 A + B Again(16进制加法)

A + B Again

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 21951    Accepted Submission(s): 9489

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

题解:注意输出的字母是大写的

#include#include#include#include#include#include#include#include#includetypedef long long LL;using namespace std;int main(){ LL a,b; while(scanf("%llX %llX",&a,&b)!=EOF) { getchar(); b+=a; if(b<0) { b=-b; printf("-"); } printf("%llX\n",b); } /* LL a,b; while(cin>>hex>>a>>b) { LL t=a+b; if(t<0) cout<<'-'<

AC代码:

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Android通用流行框架大全(android最火的框架)
下一篇:vmware安装ubuntu
相关文章

 发表评论

暂时没有评论,来抢沙发吧~