Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-*-coding:utf8;-*-
- #qpy:2
- #qpy:console
- def mysqrt(a):
- if a == 0: return 0
- top = a
- bottom = 1
- x = (top + bottom) // 2
- while (top > bottom):
- if(x*x < a):
- bottom = x+1
- else:
- top = x-1
- x = (top + bottom) // 2
- while (x+1)*(x+1) <= a:
- x+=1
- while x*x > a:
- x-= 1
- return x
- #*****************
- a = int(input())
- print(mysqrt(a))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement