Problem 44768. Muphry's Law of MATLAB
You're running some simple multiplication problems through MATLAB for error checking purposes, but nothing seems to come up with the answer you should be getting. After hours of going through the codes, you realize that each of your input sets has exactly one digit mistyped, so all of your answers are incorrect. You need to regenerate the actual input you used to get these numbers.
For example, the two numbers you are multiplying together are 67 and 58. Multiplying these together should result in 3886. However, the input data you provided came up with an answer of 3596 instead. Since only one digit is incorrect in your input, you can calculate the input you used was actually [62 58], because 62*58=3596. Therefore, an input of [67 58 3596] should result in an output of [62 58]. If the input was [58 67 3596] then the output should be [58 62].
You can assume that all of the numbers will have the correct number of digits, so 7 will not have to be replaced by 37, for example. Hood Lock!
Solution Stats
Problem Comments
-
3 Comments
Test case x=[11 22 132] will cause some solutions here to fail.
Great catch! Test case added; and by "some solutions" you mean "All solutions except yours and mine."
@ Tim
Well done, Tim. I noticed the bug of my solution, but it did work for the old test suit, and I was too lazy to fix the bug.
Solution Comments
Show commentsProblem Recent Solvers39
Suggested Problems
-
2046 Solvers
-
1935 Solvers
-
1242 Solvers
-
Who has power to do everything in this world?
442 Solvers
-
306 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!