#T603. 大象喝水

大象喝水

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 quench 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. The volume of a cylinder is calculated using the formula:
[ V = \pi \times r^2 \times h ]
You may use 3.14159 as the approximation for (\pi).

Since the elephant cannot drink a fraction of a bucket, round up to the nearest integer if the total volume of water from the buckets is not exactly 20 liters.

For example, if the elephant needs 2.3 buckets, the answer should be 3.

Example

Input:

23 11

Output:

3

Explanation:
The volume of one bucket is ( 3.14159 \times 11^2 \times 23 = 8746.82 ) cubic centimeters, which is 8.74682 liters.
To reach 20 liters, the elephant needs ( 20 / 8.74682 \approx 2.287 ) buckets. Since partial buckets are not possible, the answer is rounded up to 3.

Constraints

  • ( 1 \leq h, r \leq 100 )

Solution Code

import math

h, r = map(int, input().split())
volume_per_bucket = math.pi * r ** 2 * h
total_liters_needed = 20 * 1000  # Convert 20 liters to cubic centimeters
num_buckets = total_liters_needed / volume_per_bucket
print(math.ceil(num_buckets))
23 11
3
## Source

CodesOnline