Initially Monica has total 36 pieces of candy. If 12 pieces of candy are left after a certain number of days then it means she had eaten 24 pieces of candy. Since she eats 2 pieces of candy each day thus the required number of days in which she eaten 24 pieces of candy will be:
Days in which she eaten 24 candy= Number of eaten candies/candies she eats in each day
When solving the distance formula it is the distance from one point to another. If you had a rectangle and used the distance formula from each point then you would have a perimeter