Skip to content

Commit

Permalink
수 찾기 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezidayzi committed Mar 6, 2022
1 parent 0cf4a2b commit a572ec6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Algorithm/BOJ/1920.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import sys
n = int(sys.stdin.readline().rstrip())
array = list(map(int, sys.stdin.readline().split()))

m = int(sys.stdin.readline().rstrip())
array_m = list(map(int, sys.stdin.readline().split()))

array.sort()

for target in array_m:
start = 0
end = n-1
answer = 0

while start <= end:
mid = (start + end) // 2

if array[mid] == target:
answer = 1
break
elif array[mid] > target:
end = mid - 1
else:
start = mid + 1
print(answer)

0 comments on commit a572ec6

Please sign in to comment.