13706 : 제곱근

서희찬·2022년 1월 27일
0

백준

목록 보기
99/105

문제

코드

n = int(input())

start = 1
end = n 
while start<=end:
    mid = (start+end)//2
    find=mid*mid
    if n==find:
        print(mid)
        break 
    elif n>find:
        start = mid + 1
    else :
        end = mid - 1 

해설

improt math
sqrt를 쓰면 오버플로우 에러가 뜬다.. 왜그럴까..?

이진 탐색으로 제곱근을 찾아가는 문제이다

profile
Carnegie Mellon University Robotics Institute | Research Associate | Developing For Our Lives, 세상에 기여하는 삶을 살고자 개발하고 있습니다

0개의 댓글

관련 채용 정보