To figure this out, you have to find the unit price of both.
The unit price for buying two cupcakes is 24 cents for 1 cupcake.
The unit price for buying 5 cupcakes is 25 cents for 1 cupcake. Therefore, the better buy is to buy two cupcakes. They are one cent less each.