You are not logged in. Please login at www.codechef.com 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 (https://discuss.codechef.com/problems/BASE)

asked 21 Feb '17, 17:47

rdrsadhu's gravatar image

4★rdrsadhu
1348
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

link

answered 21 Feb '17, 18:18

equlnox's gravatar image

5★equlnox
1806
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);

link

answered 15 Mar '17, 14:38

manas321's gravatar image

2★manas321
1
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 https://www.codechef.com/viewsolution/12391435 to understand clearly.

link

answered 15 Mar '17, 15:25

arjun8115's gravatar image

5★arjun8115
212
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×15,679
×2,718
×82

question asked: 21 Feb '17, 17:47

question was seen: 1,347 times

last updated: 18 Jul '18, 10:46