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.
Sample Input
1 9
A B
a b
Sample Output
10
21
21
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
String m,n;
while (s.hasNext()){
m=s.next();
n=s.next();
int i = Integer.parseInt(m, 16);
int j = Integer.parseInt(n, 16);
System.out.println(i+j);
}
}
}
总结:
重点在于
一个以字符串形式的16进制的数如何转化为int