import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 1. 2진수 문자열을 정수로 변환 (2진수이므로 radix를 2로 설정)
int num1 = Integer.parseInt(sc.nextLine(), 2);
int num2 = Integer.parseInt(sc.nextLine(), 2);
System.out.println(num1);
// 2. 비트 연산자 '&'를 사용하여 논리적 (AND) 수행
int result = num1 & num2;
System.out.println(result);
// 3. 다시 10자리 2진수 문자열로 출력 (앞에 0이 붙도록 포맷팅)
String binaryString = Integer.toBinaryString(result);
System.out.println(binaryString);
System.out.println(String.format("%10s", binaryString).replace(' ', '0'));
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: