思路:这道题我是用java写的,偷了个懒,利用了java中现成的字符串反转方法和字符串转换成Integer的方法。
import java.util.Scanner; public class Main { public static void word(){ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ String a = scan.next(); String b = scan.next(); StringBuffer c = new StringBuffer().append(a); StringBuffer d = new StringBuffer().append(b); c = c.reverse(); d = d.reverse(); a = c.toString(); b = d.toString(); Integer e = (Integer.valueOf(a)+Integer.valueOf(b)); a = e.toString(); StringBuffer f = new StringBuffer().append(a); f = f.reverse(); a = f.toString(); System.out.println(Integer.valueOf(a)); } } public static void main(String[] args) { word(); } }
转载请标明出处:牛客网――数字反转(水题)
文章来源: 牛客网――数字反转(水题)