A+b Coming
Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 6464 Accepted Submission (s): 4248
Problem Descriptionmany classmates said to me, a+b is must needs.
If you can ' t AC this problem, you would invite me for night meal. ^_^
Inputinput may contain multiple test cases. Each case contains A and B on one line.
A, B is hexadecimal number.
Input terminates by EOF.
Outputoutput a+b in decimal number on one line.
Sample Input
1 9A Ba b
Sample Output
102121
There is no word in this question ... I've seen it before, but forget it!! Knowledge One: Converting 16 into a 10-in exception: AB converts to Dec;0xab
= 0x0A * + 0x0B
= 10 * 16 + 11
= 171
C input hexadecimal and octal methods: scanf ("%x%x", &a,&b); scanf ("%o%o", &a,&b);
The C + + method:cin>>hex>>a>>b;cin>>oct>>a>>b; output is similar to the
If you lose, you have to eat! AC:
#include <iostream>using namespace Std;int main () {int a,b;while (cin>>hex>>a>>b) cout <<dec<<a+b<<endl;return 0;}
Hangzhou Electric HDU ACM 1720 a+b Coming