Sunday, 1 May 2011

Salary

Question: 4 persons are sitting in dinner table taking lunch .They are working in the same company.They do not know the salary of each other.They can not disclose the salary.
what is the way to know the salary of each person?....
-------------------------------------------------------------------------------------------------------
Answer:
A , B , C,D are 4 person
A gives a random number to B=a1
B gives a random number to C=b1
C gives a random number to D=c1
D gives a random number to A=d1
Since A knows his salary i.e. a
so
 A will know B's Salary by= a+d1-a1;
similarly

Since B knows his salary i.e. b
so B will know C's Salary by= b+a1-b1;
Since C knows his salary i.e. c
so C will know D's Salary by= c+b1-c1;
Since D knows his salary i.e. d
so D will know A's Salary by= d+c1-d1;


X and O

Question:
 The game of Tic -Tac-Toe is played in a large square divided into nine small squares
1.Each of the two players in turn places his or her mark -usually X or O -in  a square.
2.The player who first gets three marks in a horizontal,vertical,or diagonal line wins.
3. A player will always place his or her marks in a line that already contains  (a)Two of his or her own marks
or (b) two of his or her opponent's marks- giving(a) priority  over (b)


X  1
O 2
3 
X 4
      5 
6 
O 7
O 8
X 9


=================================================================

Answer:
We have to find
 1.  Who will take the next move (either X or O)
 2. Where will the next move in the square takes place.
Here we will find  who had make the first move.
The cells are marked as 1,2,3,4,5,6,7,8,9

Here the next move will be in the cell 5 (either X or O)

The optimal solution is
*********************************************************
The first move is O at 2.
Next move will be X at  4.
Next move will be O at 7.
Next Move will be X at  1.
Next Move will be O at 8.
Next Move will be X at 9.
So next move will be O at 5 .and he will win
*********************************************************






Wednesday, 13 April 2011

The Fight

question
Two of Anthony ,Bernard ,and Charles are fighting each other.
1. The shorter of Anthony and Bernard is the older of the two fighters.
2.The younger of Bernard and Charles is the shorter of the two fighter.
3.The taller of Anthony and Charles is the younger of the two fighters.

-----------------------------------------------------------------------------------------
Answer:

From case 1: Suppose  we consider Bernard as shorter then Anthony.
This implies that
1. Bernard is one of the fighter .
2. Bernard is older then the other fighter .
3.Anthony is taller then Bernard.


Now this implies that Bernard is one of the fighter:
from case 2:-Since Bernard is older then other fighter so to make case 2 true Charles will be one of the two fighter.And he will be younger Then Bernard.

This implies that Charles is other fighter.
This implies that
1.Charles is other fighter
2.Charles is younger then Bernard.
3.Charles is shorter then Bernard.

 from case 3:The taller of Anthony and Charles is the younger of the two fighters.

Since from case 1 and 2 assumption we concluded that  Bernard and Charles are fighter
so Charles will be taller then Anthony.
But since Anthony is taller then Bernard
Charles is shorter then Bernard. this can not be possible .
so out first consideration was wrong.
-----------------------------------------------------------------------------------------------
Now lets consider in other way
taking case 1:  The shorter of Anthony and Bernard is the older of the two fighters.

Anthony will be shorter then Bernard
Anthony will be older then other fighter.
.Anthony is one of the two fighter

case 2:  The younger of Bernard and Charles is the shorter of the two fighter.
Hear we consider Charles as fighter .
Charles is younger then Bernard
Charles is shorter then Anthony.
Bernard is older then charles.

 case3:The taller of Anthony and Charles is the younger of the two fighters.

This implies Chales is taller then anthony .
so our case 2 consideration will be wrong
so Bernard will be another fighter

Final conclusion

So Anthony is Taller then Bernard
Bernard is oldre then anthony
Charles is not fighting
Bernard is shorter then everybody

Charles is not fighting