Problem 42670. If you prick us, do we not bleed?

Created by James in Community

While doing some quick sewing to fix up your child's Halloween costume, you accidentally jab your finger with the needle. Reflexively, you drop the needle on the hardwood floor. To take your mind off of the pain, you notice that the needle has a length of L cm, and the boards in your floor are all T cm apart.

Taking a break from your sewing, you decide to write out (you can't type very well just yet, since your finger still hurts!) a MATLAB script that will determine the probability of a dropped needle touches at least one line between two of your floorboards.

The inputs to your script are L (the length of the needle) and T (the thickness of the planks that make up your hardwood floor.) The output should be the probability that needle intersects at least one line between your floorboards.

Solution Stats

85.29% Correct | 14.71% Incorrect
Last solution submitted on Nov 05, 2018

Solution Comments