Can someone please provide me with Editorial of Problem BASE (December Long Challenge 2016)

Contest Problem: here

Practice Problem: here

Also the link for the Editorail doesn’t works (https://discuss.codechef.com/problems/BASE)

First of all, for N=1 answer is INFINITY and for N=0 answer is 0.

For all other values of N :-

We can find all the bases for what representation of N starts with 1 and there are d digits in the representation.
For this bd<=N and 2×bd>N.

This can be written as b<=N(1/d) and b>(N/2)(1/d).

Simply using pow function gives precision errors here so we have to use binary search instead.

Now you can do two binary searches on b for numbers from 1 to 10(12/d) for the above two conditions for all possible d.

Here d can be at most 40 as 240 > 1012

1 Like

I saw a solution and the following code was written what does that means
m=pow(n,(1/(double)j)+1e-15);
k=pow(n/2,(1/(double)j)+1e-15);

@manas321 this statement m and k gives the range…and when u go deeply in this question,u will derive an formula that u have to find the range between m and k.Here m is equal to the power of n^(1/j) nd k denotes power of (n/2)^(1/j)…nd abve statement of finding the power finds an accurate value as m=pow(n,(1/(double)j)+1e-15)…otherwise there seems to be an error in finding ranges…u can see my solution https://www.codechef.com/viewsolution/12391435 to understand clearly.