[白俊12833-Kotlin]XORXOR


質問リンク
import java.io.BufferedReader
import java.io.BufferedWriter

private lateinit var bufferedReader: BufferedReader
private lateinit var bufferedWriter: BufferedWriter

fun main() {
    bufferedReader = System.`in`.bufferedReader()
    bufferedWriter = System.out.bufferedWriter()
	
    // 1. get (a, b, c)
    val (a, b, c) = bufferedReader
        .readLine()
        .split(" ")
        .map { it.toInt() }

    var answer = a
    
    // 2. c가 홀수인 경우에만 xor 한번 해주면 됩니다.
    if (c and 1 == 1) answer = answer xor b
    bufferedWriter.write("$answer")

    bufferedReader.close()
    bufferedWriter.close()
}