注意直接用十六进制 #include<iostream> using namespace std; int main() { int a,b; while(cin>>hex>>a>>b) { cout<<a+b<<endl; } }