## A+B Coming

Time Limit: 1 Sec  Memory Limit: 125 MB
Submissions: 32  Solved: 15
[Submit][Status][Discuss]

## Description

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.

```1 9
A B
a b```

## Sample Output

```10
21
21```

Code:
1. #include <iostream>
2. using namespace std;
3. int a,b;
4. int main(){
5. while(cin>>hex>>a>>b)
6. cout<<dec<<a+b<<endl;
7. return 0;
8. }
9. /**************************************************************
10. Problem: 1563
11. User: mmoaay
12. Language: C++
13. Result: Accepted
14. Time:0 ms
15. Memory:1352 kb
16. ****************************************************************/

dec-十进制（默认）

oct-八进制

hex-十六进制

Code:
1. int i,j,k,l;
2. cout<<“Input i(oct) j(hex) k(hex) l(dec):”<<endl;
3. cin>>oct>>i;                                            //输入为八进制数
4. cin>>hex>>j;                                            //输入为十六进制数
5. cin>>k;                                                 //输入仍为十六进制数
6. cin>>dec>>l;                                            //输入为十进制数
7. cout<<“hex:”<<“i=”<<hex<<i<<endl;
8. cout<<“dec:”<<“j=”<<dec<<j<<‘\t'<<“k=”<<k<<endl;
9. cout<<“oct:”<<“l=”<<oct<<l;
10. cout<<dec<<endl;                                        //恢复十进制输出状态