NZEC in spoj FACKT

Posted by frodo on Stack Overflow See other posts from Stack Overflow or by frodo
Published on 2012-03-01T07:12:59Z Indexed on 2013/11/10 3:54 UTC
Read the original article Hit count: 124

Filed under:
|

I was trying to solve this problem http://www.spoj.pl/problems/FACKT/, and I keep getting a Non-Zero Exit Code (NZEC). How exactly do I figure out what to change in the code to overcome this?

Here is the code

import math
import sys
def cal_num(n):

    i = 1
    f = 1
    while f<n:
        f *= i
        i = i + 1
    return i-1


while 1:
    line = sys.stdin.readline()
    if line == "":
        break
    n = int(line)
    x = cal_num(n)
    y = math.factorial(2*x)
    l = int(math.ceil(math.log(y,10)))
    print (x,l)

Any suggestion would be welcome.

© Stack Overflow or respective owner

Related posts about python

Related posts about nzec