[Python]알고리즘/코드업
[기초-비트단위논리연산]
HSY_mumu
2022. 3. 16. 14:51
728x90
<비트단위 논리연산자>
& | and |
| | or |
^ | xor |
~ | not |
6059 - 비트단위로 NOT 하여 출력하기
a = int(input())
print(~a) #비트 not
6060 - 비트단위로 AND 하여 출력하기
a, b = map(int, input().split())
print(a & b) #비트 and 연산
6061 - 비트단위로 OR 하여 출력하기
a, b = map(int, input().split())
print(a|b) # 비트 or 연산
6062 - 비트단위로 XOR 하여 출력하기
a, b = map(int, input().split())
print(a^b) #비트 xor 연산
728x90