acm 2057

时间:2023-12-22 17:40:38

////////////////////////////////////////////////////////////////////////////////
#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;

}

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

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