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 V_{rectangle} = L \times W \times H.

Then, we calculate the volume of the cylinder removed from the pumpkin dictated by the formula V_{cylinder} = \pi \times (\frac{D}{2})^2 \times H.

Finally, we subtract V_{cylinder} from V_{rectangle} and output the result to at least 2 decimal places of accuracy to satisfy the checker.

Time Complexity: \mathcal{O}(1)


Comments

There are no comments at the moment.