Many classmates said to me that A+B is must needs. If you can’t AC
this problem, you would invite me for night meal. _
Input
Input may contain multiple test cases. Each case contains A and B in
one line. A, B are hexadecimal number. Input terminates by EOF.
Output
Output A+B in decimal number in one line.
Sample Input
1 9
A B
a b
Sample Output
10
21
21
%x是十六进制!
#include <cstdio>
int main()
{
int a,b;
while(~scanf("%x %x",&a,&b))
printf("%d\n",a+b);
return 0;
}
本文探讨了如何处理十六进制数的加法运算,并通过C++编程语言提供了一个具体的解决方案。输入包含多个测试用例,每个用例包含两个十六进制数A和B,任务是将它们相加并输出十进制结果。代码使用了C++的输入输出流和十六进制转换功能。
754

被折叠的 条评论
为什么被折叠?



