Pouring Rain (CodeForces - 667A )

Pouring Rain (CodeForces - 667A )

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.

Input

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.

Output

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.

Examples

Input

1 2 3 100

Output

NO

Input

1 1 1 1

Output

YES
3.659792366325

Note

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.

题目翻译:

伯兰有很多人讨厌下雨,但你不讨厌。雨平息了,整理了你的思绪。这些年来,你已经形成了一个良好的传统——下雨时,你走在街上,沉默片刻,环顾四周,享受新鲜,想想你必须做的大事。

今天一切都悄然改变了。你拿着一杯水走在街上,这是你最喜欢的饮料。当你喝水的时候,你注意到这个过程变得很长:因为下雨,杯子里仍然有水。你决定为正在发生的事情建立一个正式的模型,看看是否有可能在那种情况下喝光所有的水。

因此,你的杯子是一个直径等于d厘米的圆柱体。杯子里的初始水位与底部距离为h厘米。

你喝的水的速度等于每秒v毫升。但是雨下得如此之快,如果你不喝杯子里的水,水的水位会以每秒e厘米的速度增加。从杯子里喝水和往杯子里加雨水的过程是均匀而连续的。

找时间把杯子倒空,否则你会发现它永远不会发生。如果有可能喝完所有的水,保证不迟于104秒。

注意1毫升等于1立方厘米。

输入

输入的唯一一行包含四个整数d, h, v, e(1≤d, h, v, e≤104),其中:

d -圆柱形杯的直径,

h -杯子里的初始水位,

v -从杯子里喝东西的速度,单位是毫升每秒,

成长的水,因为下雨,如果你不喝从杯子。

输出

如果无法清空杯子,请打印“NO”(不带引号)。

否则,请在第一行打印“YES”(不带引号)。在第二行打印一个真实的数字-时间,以秒为单位需要的杯子将是空的。如果答案的相对或绝对误差不超过10 - 4,则认为是正确的。可以保证,如果答案存在,它不超过104。

例子

输入

1 2 3 100

输出

没有

输入

1,1,1,1

输出

是的

3.659792366325

请注意

在第一个例子中,水充满杯子的速度比你喝水的速度快。

在杯子底部的第二个例子中面积等于,因此我们可以得出这样的结论,你把水的水位降低了厘米每秒。同时,由于下雨,水位每秒钟增加1厘米。因此,杯子将在几秒钟内被清空。

思路:判断一下喝水的速度和进水的速度的大小,如果喝水的速度大于进水的速度,则可以喝光。

AC代码:

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <queue>
#include <stack>
#include <map>
#define PI 3.1415926
using namespace std;
int main()
{
    double d,h,v,e;
    scanf("%lf%lf%lf%lf",&d,&h,&v,&e);
    double ee=(d/2)*(d/2)*PI*e;
    double dd=(d/2)*(d/2)*PI*h;
    if(v>ee)
    {
        double sum=dd/(v-ee);
        printf("YES\n");
        printf("%lf\n",sum);
    }
    else
        printf("NO\n");
    return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值