SAC '22 Code Challenge 1 P2 - That Circle

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 256M

Problem types

Recently, Zain has been entranced by circles and their applications. He starts taking rectangular pumpkins and cutting out perfect cylinders. However, Zain completely forgot that he has Halloween class and will need to use that remaining pumpkin!

Given that you are a programming genius, Zain asks you for help.

Zain tells you that he had a rectangular pumpkin with an integer length of L, integer height of H, and integer width of W then removed a cylinder of height H (the same as the pumpkin) and integer diameter D from the pumpkin.

Calculate the amount of pumpkin Zain still has left before his Halloween class!

Input Specification

The first line will contain 3 integers: L (1 \le L \le 1\,000), H (1 \le H \le 1\,000), and W (1 \le W \le 1\,000), the length, height, and width of the pumpkin, respectively.

The second line will contain an integer, D (1 \le D \le \min(L, W)), the diameter of the cylinder removed from the pumpkin.

Note: The checker will accept an answer up to an absolute error of 10^{-2}.

Output Specification

Output the amount of pumpkin remaining.

Sample Input

1 1 1

Sample Output



There are no comments at the moment.