1 / 3
Dec 2006

i am new to python and can't figure why i have this NZEC error
now i have implemented binary search to find the cube root..
i think i have take care of new line and extra spaces by using raw_input()...
then reconstructing the number by not considering the extra spaces...
then doing a binary search to find the cuberoot

tc=input();
k=0;
while(k<tc):
    m=raw_input();
    t=0;
    cntr=0;
    while(cntr!=len(m)):
        if m[cntr]==' ':
            cntr=cntr+1;
            continue;
        t=t*10+(int)(m[cntr]);
        cntr=cntr+1;
    if t==0:
        continue;
    t=t*(10**30);
    mm=t;
    cntr=0;
    while(mm!=0):
        mm=mm/10;
        cntr=cntr+1;
    if cntr%3==0:
        power=(cntr/3)-1;
    else:
        power=(cntr/3);
    min=10**power;
    max=10*min;
    min1=0;
    test=-1;
    while(min1!=test):
        min1=test;
        test=(max+min)/2;
        testing=test**3;
        if testing>t:
            max=test;
        else:
            min=test;
    checksum=0;
    while(min1!=0):
        r=min1%10;
        checksum=checksum+r;
        min1=min1/10;
    checksum=checksum%10;
    test2=test%(10**10);
    test=test/(10**10);
    print checksum,'%d.%d'%(test,test2);
    k=k+1;
    

i have multiplied number by 10^30 so as not to deal with decimals
cud an administrator look in this and tell me why nzec is occuring