解题思路:
注意事项:
参考代码: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String str1=sc.next(); String str2=sc.next(); String sb1=new StringBuilder(str1).reverse().toString(); //StringBuilder().reverse().toString() 将反转后的的数转成字符串 String sb2=new StringBuilder(str2).reverse().toString(); String str3=Integer.parseInt(sb1)+Integer.parseInt(sb2)+""; String sb3=new StringBuilder(str3).reverse().toString(); System.out.println(Integer.parseInt(sb3));//题目要求是整型 为字符串提交是错的 } }
0.0分
1 人评分
Tom数 (C语言代码)浏览:735 |
简单的a+b (C语言代码)浏览:721 |
【出圈】 (C语言代码)浏览:553 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:1419 |
C语言考试练习题_保留字母 (C语言代码)浏览:700 |
The 3n + 1 problem (C语言代码)浏览:548 |
1025题解浏览:732 |
Tom数 (C语言代码)浏览:525 |
C二级辅导-统计字符 (C语言代码)浏览:476 |
简单的a+b (C语言代码)浏览:818 |