加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

[字符串][第二阶段-字符串处理][HDOJ-2031]A + B Again

发布时间:2020-12-14 02:50:40 所属栏目:大数据 来源:网络整理
导读: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 contai
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
?


#include<stdio.h>
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
    __int64 a,b;
    while(scanf("%I64X%I64X",&a,&b)!=EOF)
    {
        __int64 sum =a + b;
        if(sum < 0)
        {
            sum =- sum;
            printf("-");
        }
        printf("%I64Xn",sum);
    }
}

??

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读