Editorial for SAC '22 Code Challenge 1 P2 - That Circle


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: maxcruickshanks

First, we calculate the volume of the pumpkin dictated by the formula Vrectangle=L×W×H.

Then, we calculate the volume of the cylinder removed from the pumpkin dictated by the formula Vcylinder=π×(D2)2×H.

Finally, we subtract Vcylinder from Vrectangle and output the result to at least 2 decimal places of accuracy to satisfy the checker.

Time Complexity: O(1)


Comments

There are no comments at the moment.