why i got this error in python??

here is my solution link solution link

please tell me ASAP…as I m new for python

why i got this error in python??

here is my solution link solution link

please tell me ASAP…as I m new for python

Hi rcsldav2017,

in python if integer value get overflow then it automatically converted to Big Integer which is inbuilt class and big integer can hold much larger integer value

but python does not automatically convert float or double hence when you are taking square root of big integer then it gives RUNTIME because it can not manage that big value hence if you want to store big float value then you should use decimal.Decimal(Big Decimal) module of python which is same as Big Integer but it requires function to operate you cant use this as Big Integer. decimal.Decimal will help you to store big decimal value but it will overkill try another efficient method to solve this question because it is very slow.

python

2 Likes

how to use Biginteger class in python??

It is automatic in Python 3+

please see this: http://stackoverflow.com/questions/538551/handling-very-large-numbers-in-python

can anyone can provide me detailed tutorial for BIG Integer in python ??

hello rcsldav2017,

as @abcdexter24 and me mention above that Big num(called big num in python and Big integer in java) is handled automatically in python you do not need to worry about it you can freely apply arithmetical operation (but remember one thing that result must remain integer like 5/3 is not allowed because result is float) take care in case of divide because it may lead result to float. same thing you were doing in this question by taking sqrt that is not allowed.

but when we wanna work with big decimal then python does not handle it automatically you have to use library mean if you wanna add,multiply,divide,subtract any two number then you have to use respective function of big decimal and also you have to take care of precision. function is available for handling precision means for any operation you have to use library that’s all

i really hate this library never used it. if you find python more interesting then go for it otherwise leave it there are many way to solve question infact this is not a way to solve competitive programming question i am java fan. in java we have to use library for big integer also python manage it automatically but in case of big decimal neither java nor python manage it. we have to manage it manually. if you are interested then here is official site link just go and try to understand you will get this all after 2-3 day of stress

1 Like

thanks bro

#my code for adding two numbers is:

def flow001():

t=int(input())

while t:

a=int(input())

b=int(input())

print(a+b)

t-=1

flow001()

1 Like

I think you should use main function besides flow001