291. Cube Root Problem code: CUBERT
def lower_bound(high,low, n):
while low<=high:
mid= (low+high)/2
a= mid*mid*mid
b=(mid+1)*(mid+1)*(mid+1)
if a==n or (a<n and b>n):
return mid
elif a<n:
low=mid+1
else:
high=mid-1
return mid
i=0
t=input()
while i<t:
s1=raw_input()
if(len(s1)>0):
i+=1
n=long(s1)
ans1=long(pow(n,1/3.0))
k=long(pow(n,1/2.0)*pow(10,10))
n*=pow(10,30)
ans=lower_bound(k,long(ans1 *pow(10,10)),n)
ans=str(ans)
root=ans[:-10]+"."+ans[-10:]
count=0
for c in root:
if(c>='0' and c<='9'):
count=(count%10+int(c))%10
final=str(count)+" "+root
print(final)
def lower_bound(high,low, n):
while low<=high:
mid= (low+high)/2
a= mid*mid*mid
b=(mid+1)*(mid+1)*(mid+1)
if a==n or (a<n and b>n):
return mid
elif a<n:
low=mid+1
else:
high=mid-1
return mid
i=0
t=input()
while i<t:
s1=raw_input()
if(len(s1)>0):
i+=1
n=long(s1)
ans1=long(pow(n,1/3.0))
k=long(pow(n,1/2.0)*pow(10,10))
n*=pow(10,30)
ans=lower_bound(k,long(ans1 *pow(10,10)),n)
ans=str(ans)
root=ans[:-10]+"."+ans[-10:]
count=0
for c in root:
if(c>='0' and c<='9'):
count=(count%10+int(c))%10
final=str(count)+" "+root
print(final)