You have a swimming pool that is filled to the brim with water. You need to empty it, but you can't think of an efficient method. So you decide to use your red solo cup. You will repeatedly fill the cup all the way and dump it outside the pool.
How long will it take to empty the pool?
[shape of pool] [dimensions] [shape of cup] [dimensions] [speed]
shape of poolwill be one of these strings:
rectangle. Note that these actually refer to the 3-dimensional shapes: cylinder, triangular prism, and rectangular prism.
dimensionswill be different depending on the shape.
[radius] [height]. Volume = π r2 h
[base] [height] [length]. Volume = 1/2(bh) * length
[width] [length] [height]Volume = lwh
shape of cupand
dimensionswork the same way. The cup can also be either a circle, triangle, or rectangle.
speedis the amount of time it takes to empty one cup full of water in seconds.
The number of seconds it takes to empty the swimming pool. This can be rounded to the nearest second.
- There will be no units in the input. All distance units are assumed to be the same (a shape won't have a height in inches and a width in feet).
- Use 3.14 for
- Input will be made up of strings and floating-point numbers.
- It will never rain. No water will ever be added.
- You have a very steady hand. You will fill the cup exactly to the brim every time, and you will never spill any.
- Once you get near the end, it will get hard to scoop up a full cup of water. You do not need to worry about this. You're very strong, so you can tilt the pool onto its side (without using up any more time).
- Anytime you make a calculation, it's okay to round to the nearest hundredth. Your final answer will not need to be exact.
triangle 10 12.25 3 circle 5 2.2 5
Even though there is less than 172.7 left on the last scoop, it still takes the whole five seconds to empty it.
triangle 5 87.3 20001 rectangle 5.14 2 105.623 0.2
- You should round to the nearest hundredth after each calculation.
- The final calculation is rounded up from 804.05567 to 804.2. This is because that last little bit of water must be emptied.
- You can write a full program or function.
- Input should be taken from stdin or function parameters. Output should be printed through stdout or returned.
- The input format can be rearranged, as long as you specify that in the submission. You can also shorten the strings "circle", "triangle", and "rectangle."
- Libraries and built-in functions that involve volume or area are not allowed.
This is code-golf. Submission with least number of bytes wins.