Problem B
Sing a Song of Sixpence
Sing a song of sixpence, a pocket full of rye,
Four and twenty blackbirds baked in a pie.
When the pie was opened, the birds began to sing,
Wasn’t that a dainty dish to set before the king?
Now that’s kind of scary! Uncooked and possibly unplucked birds squeezed into a pie! Anyway, we won’t concern ourselves with those implausible details. Instead, we’ll focus on variations in the size and consequently the number of birds in pies. Imagine that the pies are shaped like traditional inverted truncated cones and that birds are flexible enough to pack into the pies without gaps.
Your task is to determine how many complete birds can be packed into a pie. You will be provided with the top and bottom diameters along the height of the pie as well as the volume of a bird.
Hint: The volume of a "truncated cone" (which is essentially what the pie is shaped like) is $v=\pi h(R^2 + Rr + r^2)/3$ where $v$ is the volume, $\pi $ can be set to $3.14159$, $R$ is the larger radius, $r$ is the smaller radius, and $h$ is the height.
Input
The first three lines contain the dimensions of the pie respectively in centimeters, correct to 2 decimal places: the larger (upper) radius $R$, the smaller (lower) radius $r$, and the height $h$. They may range from 10 to 100 centimeters each. The fourth line of input contains the volume of a bird (1-1000 cubic centimeters).
Output
Output how many whole birds could have fit in the pie. For this, print the number (an integer), a space ’ ’, and then the word "birds" on a single line, even if the answer is just one bird.
Sample Input 1 | Sample Output 1 |
---|---|
20 15 10 500 |
19 birds |
Sample Input 2 | Sample Output 2 |
---|---|
10.00 10.00 10.00 1000.00 |
3 birds |
Sample Input 3 | Sample Output 3 |
---|---|
100 100 100 1 |
3141590 birds |