A perfect example for boolean mapping problems

Boolean mapping and other type of mapping is one of the typical adhoc method to solve a question..

My first program is about solving a puzzle of this sort. The puzzle is actually a technothlon math puzzle for school students (pen and paper based, not coding). I had tough time to solve the question using basic math logic, then i wondered “How about solving the question using a program”. That’s how I got introduced myself to the programming world.

The puzzle is as follows :

Q.There are 1000 bulbs and 1000 children in a big hall. The first child lights up all the bulbs. The second one puts off every second bulb. The third child then reverts the state of every third bulb. The fourth one does the same with every fourth bulb and so on. When all the 1000 children do their part, how many bulbs are still switched off?

You might have solved this question, but you may not have tried to write a program for it.

So, after a long time (2 to 3 moths). I have encountered another problem of this sort at codechef.(Closing the Tweets)

Screenshot from 2014-05-08 18:49:56


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s