题解 | #不想出差的HR#

不想出差的HR

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

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        String[] inputs = in.nextLine().split(",");
        int a = Integer.parseInt(inputs[0]);
        int b = Integer.parseInt(inputs[1]);
        int c = Integer.parseInt(inputs[2]);

        int value = a ^ b ^ c;

        if (value == 0) {
            System.out.println(1);
        } else {
            if ((a ^ value) < a) {
                System.out.println("A," + (a - (a ^ value)));
            } else if ((b ^ value) < b) {
                System.out.println("B," + (b - (b ^ value)));
            } else if ((c ^ value) < c) {
                System.out.println("C," + (c - (c ^ value)));
            }
        }
        in.close();
    }
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-10 14:10
啊啊啊啊好幸福,妈妈是我找工作发疯前的一束光
榕城小榕树:你是我见过最幸福的牛客男孩
点赞 评论 收藏
分享
05-30 12:03
山西大学 C++
offer来了我跪着...:不是骗子,等到测评那一步就知道为啥这么高工资了
点赞 评论 收藏
分享
05-22 09:23
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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