题解 | #23年OPPO-a的翻转#
23年OPPO-a的翻转
https://www.nowcoder.com/practice/dcce2d0cc8f740c29e0885df96c9d625?tpId=376&tqId=10816557&ru=/exam/oj&qru=/ta/15-days-help/question-ranking&sourceUrl=%2Fexam%2Foj%3FquestionJobId%3D10%26subTabName%3Donline_coding_page
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); StringBuilder s = new StringBuilder(); int c = Integer.parseInt(s.append(a).reverse().toString()); System.out.println(a+c); } }
翻转这里就是 12 => 21, 1234 => 4321