Logic Development Problems

Download Report

Transcript Logic Development Problems

Logic Development Problems
Puzzle #1
• After-Dinner Drink
– Alok, Bharat, and Chandra often eat dinner out.
– Each orders either coffee or tea after dinner.
– If Alok orders coffee, then Bharat orders the drink that
Chandra orders.
– If Bharat orders coffee, then Alok orders the drink that
Chandra does’nt order.
– If Chandra orders tea, then Alok orders the drink that
Bharat orders.
• Who do you know always orders the same drink
after dinner?
Puzzle #1
•
•
•
•
•
•
•
•
1
2
3
4
5
6
A orders
B orders
Coffee
Coffee
Coffee
tea
tea
Coffee
tea
tea
tea
Coffee
tea
tea
C orders
Coffee
tea
Coffee
tea
tea
tea
Puzzle #1
•
• From second IFcondition , 1st and 5th
row are eliminated. From third IF
condition, 2nd and 5th are eliminated.
• So A always the same drink Tea
Puzzle #2
• Can you divide the number 45 into four
parts such that when 2 is added to the first
part, 2 is subtracted from the second part,
2 is multiplied by the third part and the
fourth part is divided by 2. All the four
results should be the same number.
Puzzle #2
• Let a, b, c, d be the four parts. Then
a+b+c+d=45. It is given that
• a+2 = b-2 = 2c = d/2;
• a=b-4;
• c = (b-2)/2;
• d =2(b-2);
• b-4 + b + (b-2)/2 + 2(b-2) = 45;.
Puzzle #2
•
•
•
•
B=12.
A= b-4 =8
C=5
D=20
Puzzle #3
• There was a man who had six sons. The man possessed
a huge amount of gold, which he hid carefully in a
building consisting of a number of rooms. In each room
there were a number of lockers; this number of lockers
was equal to the number of rooms in the building. Each
locker contained a number of golden coins that equaled
the number of lockers per room. When the man died,
one locker was given to the old loyal servant. The
remainder of the gold coins has to
• Divided fairly equal among all six sons. How can you say
that such an even distribution is possible in this case or
will there be an uneven distribution
Puzzle #3
• Let the number of rooms be N. This
means that per room there are N lockers
with N coins each. In total there are
N×N×N = N3 coins. One locker with N
coins goes to the servant. For the six
brothers, N3 - N coins remain.
Puzzle #3
• This can be written as : N(N2 - l), or N(N 1)(N + l). This last expression is divisible
by 6 in all cases, since a number is
divisible by 6 when it is both divisible by 3
and even. This is indeed the case here:
whatever N may be, the expression N(N 1)(N + l) always contains three successive
numbers.
Puzzle #3
• One of those is always divisible by 3, and
at least one of the others is even. This
even holds when N=1; in that case all the
brothers get nothing, which is also a fair
division!
Puzzle #4
• A person wanted to withdraw X rupees
and Y paise from the bank. But cashier
made a mistake and gave him Y rupees
and X paise. Neither the person nor the
cashier noticed that. After spending 20
paise, the person counts the money. And
to his surprise, he has double the amount
he wanted to withdraw.
Find X and Y. (1 Rupee = 100 Paise).
Puzzle #4
• Let the original check be for A Rupees and
B paise or (100A + B) paise.
John actually received B Rupees and A
paise or (100B + A) paise
After spending 20 paise, he has double
the amount he wanted to withdraw.
Puzzle #4
• Hence, the equation is
• 2 * (100X + Y) = 100Y + X - 20
200X + 2Y = 100Y +X - 20
199X - 98Y = -20
• 98Y-199x=20
Puzzle #4
• Now, we got one equation; but there are 2
variables. We have to apply little bit of
logic over here. We know that if we
interchange X & Y, amount gets double.
So Y should be twice of X or one more
than twice of X i.e. Y = 2X or Y = 2X+1
Puzzle #4
• Case I :Y=2X
Solving two equations simultaneously
• 98Y - 199X = 20
Y - 2X = 0
We get X = - 20/3 & Y = - 40/2
•
Puzzle #4
• Case II :Y=2X+1
• Solving two equations simultaneously
98Y - 199X = 20
Y - 2X = 1
We get X = 26 & Y = 53
• Now, its obvious that he wanted to
withdraw Rs. 26.53