题目描述:对于一个整数X,定义操作rev(X)为将X按数位翻转过来,并且去除掉前导0。例如:
如果 X = 123,则rev(X) = 321;
如果 X = 100,则rev(X) = 1.
现在给出整数x和y,要求rev(rev(x) + rev(y))为多少?
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
in.close();
System.out.println(relv(relv(m) + relv(n)));
}
public static int relv(int n) {
int result = 0;
while(n != 0) {
result = n%10 + result*10;
n = n/10;
}
return result;
}
}