Wednesday, April 13, 2011

SPOJ 1688. A Very Easy Problem! Problem code: EASYPROB

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?

Let's Get It Started!

For those who interested in solving the problems in SPOJ, UVA and the like…

I have found that there are not many resources available on the net when I get stuck with a problem. There are very few tutorials available out there that explain how to solve a problem. I usually end up browsing through forums looking for clues…

Well… I am going to write in this blog, tutorials for some of the problems that I have and am going to solve…

However, note that I am going to write here how I solved the problem and not the BEST way to solve the problem… (hey! I am just an average coder…)

Hope this would be helpful to someone.

Happy coding!!