[字符串][第二阶段-字符串处理][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
?
Sample Output
?
#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); } }
??
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |