Classic
Clean & simple
Crystal
Glassmorphism + Neon
Cyberpunk
Neon glitch art
🚫
违规Action检测
禁止Use右键菜单
⚠️ 此Action已被系统记录
1

Moonshine

📝 Solutions 🔵 仅限 C++
Problems Description
<p>Granny is preparing moonshine whiskey for an upcoming family reunion. Because her family is large, she needs to make several batches of whiskey, which she collects in a large metal cream can. After making, and sampling, several batches Granny stumbles and knocks the can on its side. Fortunately, the lid is tightly fixed so no whiskey is lost.</p> <p>Our question to you is this: assuming that the depth of whiskey in the can was <i>k</i> cm with the can sitting upright, what is its depth with the can lying horizontal? The can itself is made of two cylinders: the body with height <i>h<sub>b</sub></i> and diameter <i>d<sub>b</sub></i>, and the neck with height <i>h<sub>n</sub></i> and diameter <i>d<sub>n</sub></i>. The neck and body are joined by a tapered conic shoulder such that the overall height of the can is <i>h</i>. The bottom and lid of the can are disks of diameter <i>d<sub>b</sub></i> and <i>d<sub>n</sub></i> respectively.</p> <p>Input consists of several test cases. Each test case consists of a line containing real numbers <i>k h<sub>b</sub> d<sub>b</sub> h<sub>n</sub> d<sub>n</sub></i> and <i>h.</i> You may assume that <i>100&nbsp;&ge;&nbsp;h&nbsp;&ge;&nbsp;h<sub>b</sub>&nbsp;+&nbsp;h<sub>n</sub></i> and that <i>100&nbsp;&ge;&nbsp;d<sub>b</sub>&nbsp;&ge;&nbsp;d<sub>n</sub></i>. A line containing 0 0 0 0 0 0 follows the last test case.</p> <p>For each test case, output a line containing <i>s</i> the depth with the can lying horizontally, rounded to two decimal places.</p> <center><img alt="" src="http://acm.student.cs.uwaterloo.ca/%7Eacm00/060924/jug.jpg" /></center>
Input格式
Output格式
Sample
Sample Input 1
5.625 10.0 10.0 5.0 5.0 15.0 0 0 0 0 0 0
Sample Output 1
5.00
Submit Code
请先Login后Submit

🤖 AI 解题助手

OpenRouter
就绪
👋 你好!我是 AI 解题助手。
我已阅读了这problems题,可以帮你points析思路、提供Code示例。
🔓 完全Free · 无需消耗 Token