why am I getting NZEC in [ NUMSUM Problem - CodeChef ] problem?
my solution
from sys import stdin
for _ in range(int(input())):
n = int(stdin.readline())
print(int((n*(n+1))/2))
why am I getting NZEC in [ NUMSUM Problem - CodeChef ] problem?
my solution
from sys import stdin
for _ in range(int(input())):
n = int(stdin.readline())
print(int((n*(n+1))/2))
Python3 is using floating point arithmetic for the operator /. That means the (huge) integer n*(n+1) is transformed to a float before dividing. Besides precision problems this yields an overflow if the number is too large.
Either use Python2 or use the operator // instead of /.
Thanks Sir