CF667A.Pouring Rain
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do.
Today everything had changed quietly. You went on the street with a cup contained water, your favorite drink. In a moment when you were drinking a water you noticed that the process became quite long: the cup still contained water because of rain. You decided to make a formal model of what was happening and to find if it was possible to drink all water in that situation.
Thus, your cup is a cylinder with diameter equals d centimeters. Initial level of water in cup equals h centimeters from the bottom.

You drink a water with a speed equals v milliliters per second. But rain goes with such speed that if you do not drink a water from the cup, the level of water increases on e centimeters per second. The process of drinking water from the cup and the addition of rain to the cup goes evenly and continuously.
Find the time needed to make the cup empty or find that it will never happen. It is guaranteed that if it is possible to drink all water, it will happen not later than after 104 seconds.
Note one milliliter equals to one cubic centimeter.
贝兰德有很多人讨厌下雨,但你并不讨厌。雨能使人平静,让思绪变得清晰。多年来,你养成了一种很好的习惯——当下雨时,你会走到街上,静默片刻,环顾四周,享受清新的空气,思考自己需要完成的重要事情。
今天,一切悄然发生了变化。你拿着一个装有水的杯子走上了街头,这杯水是你最喜欢的饮品。就在你喝水的那一刻,你注意到这个过程变得异常漫长:由于下雨,杯中的水始终没有减少。于是你决定为这一现象建立一个正式的数学模型,并判断在这种情况下是否有可能将杯中的水全部喝完。
因此,你的杯子是一个圆柱体,其直径为 d 厘米,初始水位高度(从杯底起算)为 h 厘米。

你喝水的速度为 v 毫升/秒。但同时,雨水以这样的速度落入杯中:若你不喝水,杯中水位将以每秒 e 厘米的速度上升。喝水与雨水注入的过程均是均匀且连续进行的。
请计算使杯子变空所需的时间;若杯子永远无法变空,则输出相应说明。题目保证:若杯子最终能变空,则该事件一定在 104 秒内发生。
注意:1 毫升 = 1 立方厘米。
输入格式
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where:
- d — the diameter of your cylindrical cup,
- h — the initial level of water in the cup,
- v — the speed of drinking process from the cup in milliliters per second,
- e — the growth of water because of rain if you do not drink from the cup.
输入仅有一行,包含四个整数 d、h、v、e(1≤d,h,v,e≤104),其中:
- d — 你的圆柱形杯子的直径,
- h — 杯中水的初始高度,
- v — 你从杯中喝水的速度(单位:毫升/秒),
- e — 若你不喝水,雨水导致的水位上升速率。
输出格式
If it is impossible to make the cup empty, print "NO" (without quotes).
Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is guaranteed that if the answer exists, it doesn't exceed 104.
如果无法使杯子变空,则输出 "NO"(不带引号)。
否则,第一行输出 "YES"(不带引号);第二行输出一个实数——杯子变空所需的时间(单位:秒)。若答案的相对误差或绝对误差不超过 10−4,则视为正确。题目保证:若答案存在,则其值不超过 104。
输入输出样例
输入#1
1 2 3 100
输出#1
NO
输入#2
1 1 1 1
输出#2
YES 3.659792366325
说明/提示
In the first example the water fills the cup faster than you can drink from it.
In the second example area of the cup's bottom equals to
, thus we can conclude that you decrease the level of water by
centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup will be empty in
seconds.
在第一个例子中,雨水灌满杯子的速度快于你喝水的速度。
在第二个例子中,杯子底部的面积等于
,因此我们可以得出结论:你每秒使水位下降
厘米。与此同时,由于降雨,水位每秒上升 1 厘米。因此,杯子将在
秒后变空。
输入解题思路,AI测评打分。不知道怎么写?