题解 | #23年OPPO-a的翻转#

23年OPPO-a的翻转

https://www.nowcoder.com/practice/dcce2d0cc8f740c29e0885df96c9d625

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        // 读取输入字符串
        String a = scanner.nextLine();
        String b = new StringBuilder(a).reverse().toString();
        
        // 将字符串转换为整数
        int x = Integer.parseInt(a);
        int y = Integer.parseInt(b);
        
        // 输出结果
        System.out.println(x + y);
        
        scanner.close();
    }
}

全部评论

相关推荐

点赞 评论 收藏
分享
长鑫存储
投递长鑫存储等公司7个岗位 >
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务