牛客网编程练习之网易2017校招题:数字翻转
这里为了方便,直接借助了StringBuilder实现翻转....
AC代码:
import java.util.Scanner;
/**
* @author CC11001100
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println(reverse(reverse(sc.nextInt()) + reverse(sc.nextInt())));
}
private static int reverse(int n){
return Integer.parseInt(new StringBuilder(Integer.toString(n)).reverse().toString());
}
}
.


浙公网安备 33010602011771号