Puzzle:
The MEATS is the result of multiplication. Each letter stands for a distinct digit. What is the 'MEATS'?
For Solution SCROLL DOWN...
Play Escape the Room Games.
Solution:
MEATS, the result of multiplication is 39784
4973 x 8 = 39784
4973 x 8 = 39784
3 comments:
4 9 7 3
x 8
--------
3 9 7 8 4
The easiest(takes less than 1 sec) way(expensive computation) of solving this type of puzzles is write a simple code like
@s = (1,2,3,4,5,6,7,8,9);#(s not equal to 0)
@e = (0,1,2,3,4,5,6,7,8,9);
@a = (0,1,2,3,4,5,6,7,8,9);
@m = (2,3,4,5,6,7,8,9);(m, t are not equal to 1 or 0)
@t = (2,3,4,5,6,7,8,9);
foreach $num (@t){
foreach $num2 (@s){
foreach $num3 (@e){
foreach $num4 (@a){
foreach $num5 (@m){
$mult = ($num2*1000)+($num3*100)+ ($num4*10)+($num5);
$result = $mult *$num;
if ((($result %10) == $num2)&& (($result %100) == (($num*10) +
$num2)) && (($result %1000) == (($num4*100)+($num*10)
+$num2)) && (($result %10000) ==
(($num3*1000)+($num4*100)+($num*10)+$num2))
&& (int($result /10000) == $num5)
) {
print "\n\n $num2 $num3 $num4 $num5 multiplier is $num result is $result \n\n";
}}}}}}
[1824][Tue 1:51am][bfiapps@devmailer][pts/1][~]> perl puzzle.pl
4973 multiplier is 8
result is 39784
============================
Can any one explain other way of solving this type of puzzles?
Above method is easiest but worst way of solving(because, worst case internal loop will executes 9*10*10*8*8 times.
Can any one explain , How to solve with paper and pencil?
Post a Comment