You are not logged in. Please login at to post your questions!


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 (

asked 21 Feb '17, 17:47

rdrsadhu's gravatar image

accept rate: 11%

edited 18 Jul '18, 10:46

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


answered 21 Feb '17, 18:18

equlnox's gravatar image

accept rate: 0%

edited 21 Feb '17, 18:28

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);


answered 15 Mar '17, 14:38

manas321's gravatar image

accept rate: 0%

@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 to understand clearly.


answered 15 Mar '17, 15:25

arjun8115's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 21 Feb '17, 17:47

question was seen: 1,347 times

last updated: 18 Jul '18, 10:46