题目链接:

A. Pouring Rain

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

题意

问杯子里的水能否被喝完,在喝水的时候还会加水;

思路

如果加水的速度大于等于喝水的速度,就喝不完,否则就可以算出喝完的时间了;

AC代码

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod=1e9+;
const int N=1e5+;
const int inf=0x3f3f3f3f;
const double PI=acos(-1.0);
int main()
{
double d,h,v,e;
cin>>d>>h>>v>>e;
d=d/;
double ans=(PI*d*d*h)/(v-PI*d*d*e);
if(PI*d*d*e>v)cout<<"NO"<<"\n";
else
{
cout<<"YES"<<"\n";
printf("%.10lf",ans);
} return ;
}

codeforces 667A A. Pouring Rain(水题)的更多相关文章

  1. codeforces 577B B. Modulo Sum(水题)

    题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  2. Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树

    A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...

  3. codeforces 696A Lorenzo Von Matterhorn 水题

    这题一眼看就是水题,map随便计 然后我之所以发这个题解,是因为我用了log2()这个函数判断在哪一层 我只能说我真是太傻逼了,这个函数以前听人说有精度问题,还慢,为了图快用的,没想到被坑惨了,以后尽 ...

  4. CodeForces 589I Lottery (暴力,水题)

    题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...

  5. Codeforces Gym 100286G Giant Screen 水题

    Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...

  6. codeforces 710A A. King Moves(水题)

    题目链接: A. King Moves 题意: 给出king的位置,问有几个可移动的位置; 思路: 水题,没有思路; AC代码: #include <iostream> #include ...

  7. codeforces 659A A. Round House(水题)

    题目链接: A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard ...

  8. CodeForces 489B BerSU Ball (水题 双指针)

    B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  9. codeforces 702A A. Maximum Increase(水题)

    题目链接: A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input sta ...

随机推荐

  1. 《从零开始搭建游戏服务器》MySQL安装配置

    一.下载资源: 到MySQL官网下载免安装版的mysql包,或者直接点击此链接下载:mysql-5.7.19-winx64.zip 二.解压配置: 将上面下载的安装包解压到一个本地目录下,在得到的my ...

  2. Mac OS X 下安装python的MySQLdb模块

    参考资料: mac os x下python安装MySQLdb模块   http://www.codeif.com/post/1073/ MAC OSX使用Python安装模块有关问题  http:// ...

  3. mysql 隔离级别与间隙锁等

    数据库隔离级 SQL标准中DB隔离级别有: read uncommitted:可以读到其它transaction 未提交数据 read committed:可以读到其它transaction 已提交数 ...

  4. windows 80端口占用情况查询

    在开始-运行,输入CMD打开命令行界面,输入命令 netstat -ano | findstr "80" (注80是你想要看查看的端口号) 就会输出包含80端口使用的情况 具体对应 ...

  5. Mac--安装kubernetes并运行echoserver

    安装minikube curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.15.0/minikube-darwi ...

  6. python发声

    python发声 学习了:http://www.jb51.net/article/62644.htm import winsound winsound.Beep(600,1000) #其中600表示声 ...

  7. 手游产品经理初探(八)CasinoStar玩家离开原因分析

    通过Delta DNA分析报告.综合我们的游戏进行思考,我总结了几条玩家流失的经验: 1.在有限的前60秒我们没有花足够的精力去吸引玩家.就是说我们要花大量的经历在玩家进入游戏的60秒的体验上(我的澳 ...

  8. UltraEdit UE常见问题 使用必读

    1 UE设置出多个tag标签,能切换的那种样子 现在的现象就是图上显示的样子,我想弄出来多个标签能切换的样子,就像浏览器的多个标签那样,怎么操作呢 视图->视图/列表->打开文件标签可以使 ...

  9. Java并发编程(三)volatile域

    相关文章 Java并发编程(一)线程定义.状态和属性 Java并发编程(二)同步 Android多线程(一)线程池 Android多线程(二)AsyncTask源代码分析 前言 有时仅仅为了读写一个或 ...

  10. MaterialImageLoading

    https://github.com/eltld/MaterialImageLoading