알고리즘/CodeUp

CodeUp 1057 - Java

leegeonwoo 2023. 8. 8. 22:21
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String[] input = sc.nextLine().split(" ");
	boolean a = Integer.parseInt(input[0]) != 0;
	boolean b = Integer.parseInt(input[1]) != 0;
	
	System.out.println(a^b? 0 : 1);
}
}

a^b는 a,b의 값이 다를 때 즉, 0 1, 1 0이 들어왔을때 true이므로 조건연산식을 0 : 1로 설정

a:1 ^ b:1 = false이므로 1출력

 

728x90