acm 2057

////////////////////////////////////////////////////////////////////////////////
#include<iostream>
#include<fstream>
using namespace std;
int main(int argc,char * argv)
{
//fstream cin("aaa.txt");
long long a,b,c;
while(cin>>hex>>a>>b)
{
c = a + b;
if(c<0)
{
c=-c;
cout<<uppercase<<hex<<"-"<<c<<endl;

}
else
cout<<uppercase<<hex<<c<<endl;
}
return 0;

}

/////////////////////////////////////////////////////////////////////////////

十六进制表示负数时采用补码,各位取反加一。

-------------------------------------------------------------逆水行舟,不进则退。
原文地址:https://www.cnblogs.com/alilliam/p/8607663.html