#T806. 大象喝水
大象喝水
Description
An elephant is thirsty and needs to drink 20 liters of water to quench its thirst. However, it only has a small cylindrical bucket with a depth of h centimeters and a base radius of r centimeters (h and r are both integers). The question is: how many buckets of water must the elephant drink at minimum to satisfy its thirst?
Input Format
The input consists of one line: two integers separated by a space, representing the depth h and the base radius r of the small bucket, both in centimeters.
Output Format
Output one line containing an integer, representing the minimum number of buckets the elephant must drink.
Note
1 liter is equal to 1000 cubic centimeters (cm³). The volume of the cylindrical bucket can be calculated using the formula for the volume of a cylinder:
[ V = \pi \times r^2 \times h ]
where ( V ) is the volume in cubic centimeters.
The elephant needs a total of 20 liters, which is 20,000 cm³. The number of buckets required is the smallest integer greater than or equal to the quotient of 20,000 divided by the volume of one bucket.
For example, if the volume of one bucket is 1500 cm³, then:
[ \text{Number of buckets} = \lceil 20000 / 1500 \rceil = 14 ]
The calculation should use ( \pi = 3.14159 ) for sufficient precision.
Example Input
10 10
Example Output
7
Explanation
For the input 10 10, the volume of one bucket is:
[ V = 3.14159 \times 10^2 \times 10 = 3141.59 , \text{cm}^3 ]
The number of buckets needed is:
[ \lceil 20000 / 3141.59 \rceil = \lceil 6.366 \rceil = 7 ]
Thus, the output is 7.
23 11
3
## Source
CodesOnline