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

×

a very easy problem

asked 10 Mar '15, 15:28

coder_baba's gravatar image

0★coder_baba
22413
accept rate: 0%


@code_baba:

The problem asks you to output some form of these numbers: 137, 1315, 73, 136, 255, 1384, 16385, one per line in the listed order.

Let’s see the first line of the correct output:

137=2(2(2)+2+2(0))+2(2+2(0))+2(0)

Hmmm… I don’t want to take the fun out the problem by giving the answer directly to you. So, I will give you a clue.

The clue:

If you have been thinking in this direction :

“How can I make the left hand side (in this case 137) to become the right hand side?”

Stop thinking!

The right direction to think for this problem is:

“How can I make the RIGHT HAND SIDE of the equation to become the left hand side?”

Got it?

Just notice the number being used again and again and you will be able to find the pattern.(Did you know :2^2=4)

link

answered 10 Mar '15, 15:57

saiavinashiitr's gravatar image

1★saiavinashiitr
906512
accept rate: 0%

Hi

In this problem you have to represent the given number in form of sum if 2^n where n>=0

for example

5=4+1=(2^2)+(2^0)

For 1-10

0=0

1=2(0)

2=2

3=2+2(0)

4=2(2)

5=2(2)+2(0)

6=2(2)+2

7=2(2)+2+2(0)

8=2(2+2(0))

9=2(2+2(0))+2(0)

10=2(2+2(0))+2

link

answered 17 Dec '16, 00:49

purush_ninja's gravatar image

1★purush_ninja
12
accept rate: 0%

12=2(2+2(0))+2(2)

link

answered 17 Dec '16, 01:55

badal7777's gravatar image

0★badal7777
1
accept rate: 0%

What!!!! wait guys, don't confuse me please

link

answered 17 Dec '16, 06:01

banghasan's gravatar image

0★banghasan
32
accept rate: 8%

Hint:

137 = 128 + 8 + 1

1315 = 1024 + 256 + 32 + 2 + 1

73 = 64 + 8 + 1

136 = 128 + 8

255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1

1384 = 1024 + 256 + 64 + 32 + 8

16385 = 16384 + 1

Every number can be written as sum of powers of 2 with each power used only once or never

link

answered 05 Sep '17, 18:39

himanshu010997's gravatar image

2★himanshu010997
31
accept rate: 0%

edited 05 Sep '17, 18:39

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:

×3,673
×632

question asked: 10 Mar '15, 15:28

question was seen: 5,191 times

last updated: 05 Sep '17, 18:39