NZEC : RUN TIME ERROR IN PYTHON

why i got this error in python??

error page

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 :slight_smile:

2 Likes

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

1 Like

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 :slight_smile:

https://docs.python.org/2/library/decimal.html

1 Like

#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()

Q) why is it showing runtime error(NZEC)? please help…

1 Like

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

thanks bro

I think you should use main function besides flow001