Start counting on the fingers on one hand thusly: 1 thumb, 2 index finger, 3 middle finger, 4 ring finger, 5 little finger, 6 ring finger, 7middle finger, 8 index finger, 9 thumb and so on.
Which finger would you end up on if you were counting to 123456789? That over 123 million in case you think it's a trick question. Assume that you aren't carted of to the funny farm while doing it.
Answer:
A complete cycle starting at thumb = 1 ends at thumb = 9. So you add 8 each time you return to the thumb. So you only need to deal with the remainder after dividing by 8. For 123456789 the remainder after dividing by 8 is 5 and that corresponds to the little finger.
This blog is for the people who are interested to learn exceptional thing in C++. Learner can find new things here and experts can share there knowledge.
Showing posts with label Puzzels. Show all posts
Showing posts with label Puzzels. Show all posts
Saturday, September 17, 2011
Saturday, June 4, 2011
Multiply a number by 7 without using * and + operator
int Num = n;
int NewNum;
NewNum = Num << 3; // mulitplied by 2 ^ 3 = 8
NewNum = NewNum - Num; // 8 – 1 = 7 if n = 1
Puzzle 3: The 8 ball problem
The problem is quite simple. You are given 8 identical-looking balls, one of which is heavier than the other 7 (all of which weigh the same). Using an old-fashioned mechanical set of scales you must identify the heavier ball using the scale as few times as possible. The scale is constructed using two bowls and an arm enabling the bowls to either balance or have one bowl rising while the other (and heavier bowl) falling. You can't just add one ball at a time thinking its one weighing, however, you may put any number of balls in each bowl... All you need to solve the puzzle is to use a bit of common sense.
Solution:
You can identify the heavier ball in only 2 weighings!!!!
To achieve this in only 2 weighings, you first put 3 balls in each bowl on the scale, e.g. {1,2,3} against {4,5,6}. Should the scale balance, you have only 2 balls remaining which you can compare by putting each in a separate bowl on the scale, e.g. {7} against {8}. Should the scale not balance, however, take the 3 balls from the heavier bowl on the scale (e.g. 1,2,3). Pick any 2 balls and compare these against each other, e.g. {1} against {2}. If the scale balances, you know it is ball 3 is the heavier. Is the scale moving, you know it's the ball on the heavier side.
Solution:
You can identify the heavier ball in only 2 weighings!!!!
To achieve this in only 2 weighings, you first put 3 balls in each bowl on the scale, e.g. {1,2,3} against {4,5,6}. Should the scale balance, you have only 2 balls remaining which you can compare by putting each in a separate bowl on the scale, e.g. {7} against {8}. Should the scale not balance, however, take the 3 balls from the heavier bowl on the scale (e.g. 1,2,3). Pick any 2 balls and compare these against each other, e.g. {1} against {2}. If the scale balances, you know it is ball 3 is the heavier. Is the scale moving, you know it's the ball on the heavier side.
Puzzle 2 : 100 coins and 7 Bags
A dealer has 100 coins and only 7 money bags. He has to divide the coins over the seven bags so that he can make any number of coins simply by handing over a few bags. How must he divide the money over the seven money bags?
Solution:
Bag 2 = 02 ( 2^1 )
Bag 3 = 04 ( 2^2 )
Bag 4 = 08 ( 2^3 )
Bag 5 = 16 ( 2^4 )
Bag 6 = 32 ( 2^5 )
Bag 7 = 37 ( 100 - ( 1 + 2 + 4 + 8 + 16 + 32 ) )
Now suppose some one ask for 1 coin he can give Bag 1, for 2 he can give Bag 2, for three he can give Bag 1+ Bag 2,....for 53 coins he can give Bag 6(32) + Bag 5(16) + Bag 3(4) +Bag 1(1) and so on...
Wednesday, April 20, 2011
Puzzle 1
Solve this by using any arithmetic operation:
1 1 1 = 6
2 2 2 = 6
3 3 3 = 6
4 4 4 = 6
5 5 5 = 6
6 6 6 = 6
7 7 7 = 6
8 8 8 = 6
9 9 9 = 6
Solution:
( 1 + 1 + 1 )! = 6
2 + 2 + 2 = 6
3 * 3 - 3 = 6
√4 + √ 4 + √ 4 = 6
5 + ( 5 / 5 ) = 6
6 + 6 - 6 = 6
7 - ( 7 / 7 ) = 6
3√8 + 3√ 8 + 3√ 8 = 6
9 + 9 / √ 9 = 6
Subscribe to:
Posts (Atom)