目录

AtCoder A 213

AtCoder

tyz020 | 08 Aug 2021

题目大意

题目给了A、B两个数字,要求出A XOR C = B中的C

解题思路

使用位运算,当A XOR C = B时,A XOR B = C

复杂度

\[O(1)\]

提交代码

import java.util.*;
import java.io.*;

public class Main{
  static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  static int A,B;
  
  public static void main(String[] args) throws IOException {
    parseInput();
    System.out.println(A ^ B);
  }
  
  public static void parseInput() throws IOException {
    String[] input = br.readLine().split(" ");
    A = Integer.parseInt(input[0]);
    B = Integer.parseInt(input[1]);
  }
}

评论区