karanyadav_bravo98's blog

By karanyadav_bravo98, history, 41 hour(s) ago, In English

Square Root of larger Numbers in python (2-Methods)

Writing this blog after solving Problem B(points on plane) Educational Codeforces Round 145 (Rated for Div. 2)

Method 1

Using Decimal Module

checkout: https://docs.python.org/3/library/decimal.html

Usage:

224067239

Method 2

Using Newton's Method

read about this method on wikipedia: https://en.wikipedia.org/wiki/Newton's_method

this will work if we want to work with integers

Source: stackoverflow

Usage:

224064574

  • Vote: I like it
  • -2
  • Vote: I do not like it

»
40 hours ago, # |
  Vote: I like it +18 Vote: I do not like it

Why go to such lengths when u can use isqrt() in python? I mean it seems as though you needed for just integers after all...

  • »
    »
    20 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I just want to discuss the methods for finding sqrt other than math module in python.

    Hope that this reply justifies...

»
17 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Hey bro! you should use binary search to solve this question