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

×

how to solve this problem

https://www.codechef.com/problems/BONDFOND

Can anyone explain with the help of an example

asked 05 Dec, 21:47

pandey_96's gravatar image

2★pandey_96
666
accept rate: 0%


The question asks for the minimum absolute difference between a number N and a number A, which is actually a power of 2. Since the minimum difference has been asked, it is obvious that A is the closest number to N that is a power of 2. Do not forget that the number A could be either less than, greater than or even equal to N. For example, if N=5, the nearest power of 2 is 4. For N=3, the nearest powers of 2 are 2 and 4. For N=8, the nearest power of 2 is 8 itself. For N=9, the nearest power of 2 is 8.

link

answered 05 Dec, 23:47

shivhek25's gravatar image

4★shivhek25
364
accept rate: 0%

First of all, what is your doubt?

you didn't get any idea to solve this question or you don't understand the question?

link

answered 05 Dec, 21:50

hruday968's gravatar image

5★hruday968
1.6k110
accept rate: 14%

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:

×914

question asked: 05 Dec, 21:47

question was seen: 128 times

last updated: 05 Dec, 23:47