Three missionaries and three cannibals come to a river and find a boat that holds two. If the cannibals ever outnumber the missionaries on either bank, the missionaries will be eaten.
CCCMMM CC C C CCMMM CC CC C CMMM MM CM CM CCMM MM MMM C CCC CC CMMM C CC CC CCCMMM --
EXPLANATION:
STEP 1: Two carnivals will go other side, one will return Now at side A CARNIVAL -2, MAMMAL-3,side B CARNIVAL-1. STEP 2: again two carnivals will go other side one will return At side A CARNIVAL-1, MAMMAL-3, side B CARNIVAL-2. STEP 3: now two mammal will go to other side and one carnival and one mammal will return .at side A CARNIVAL-2,MAMMAL-2;side B CARNIVAL-1,MAMMAL-1; STEP 4: now 2 mammals will go other side and one carnival will return. At side A CARNIVAL-3, side B MAMMAL-3 STEP 5: two carnivals will go other side and one will return Side A CARNIVAL-2, side B MAMMAL-3, CARNIVAL-1; STEP 6: two carnivals will go to other end. Side A------, side B MAMMAL-3, CARNIVAL-3.
3 comments:
Side A boat that holds drop at side B return
CCCMMM CC C C
CCMMM CC CC C
CMMM MM CM CM
CCMM MM MMM C
CCC CC CMMM C
CC CC CCCMMM --
EXPLANATION:
STEP 1: Two carnivals will go other side, one will return
Now at side A CARNIVAL -2, MAMMAL-3,side B CARNIVAL-1.
STEP 2: again two carnivals will go other side one will return
At side A CARNIVAL-1, MAMMAL-3, side B CARNIVAL-2.
STEP 3: now two mammal will go to other side and one carnival and one mammal will return .at side A CARNIVAL-2,MAMMAL-2;side B CARNIVAL-1,MAMMAL-1;
STEP 4: now 2 mammals will go other side and one carnival will return.
At side A CARNIVAL-3, side B MAMMAL-3
STEP 5: two carnivals will go other side and one will return
Side A CARNIVAL-2, side B MAMMAL-3, CARNIVAL-1;
STEP 6: two carnivals will go to other end.
Side A------, side B MAMMAL-3, CARNIVAL-3.
MISIONARIES AND CANNIBALS PROBLEM
NO OF M GO RETURN DROP
+
NO OF C
3M+3C 1M+1C 1C
1M
3M+2C
2C 1C(+1C)=2C
1C
3M+1C 2M 1M (+1C)=1M+1C
1C+1M
2M+2C 2M DROP 2M(+1M)=3M
1C
3C 2C 2C(+2M)=2C+2M
1M
1C+1M 1C+1M 1C+1M(2M+2C)
==
3M+3C
no of 'm' go return drop
+
no of 'c'
3m+3c 1m+1c 1c
1m
3m+2c 2c 1c(+1c)
=2c
1c
3m+1c 2m 1m
1c+1m
1c+1m
2c+2m 2m 2m(+1m)
=3m
1c
3c 2c 2c
1m
2c+2m
1c+1m 1c+1m 3c+3m
0c+0m 3c+3m
problem solved
Post a Comment