CodeForces 667A Pouring Rain
1 second
256 megabytes
standard input
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.
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.
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.
1 2 3 100
NO
1 1 1 1
YES 3.659792366325#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <stdio.h> using namespace std;
double d,h,v,e;
int main()
{
scanf("%lf%lf%lf%lf",&d,&h,&v,&e);
double pi=2*asin(1.0);
double ve=pi*(d/2)*(d/2)*e;
double v1=pi*(d/2)*(d/2)*h;
if(v<=ve)
{printf("NO\n");return 0;}
else
{
printf("YES\n");
printf("%lf\n",v1/(v-ve));
return 0;
} }
CodeForces 667A Pouring Rain的更多相关文章
- codeforces 667A A. Pouring Rain(水题)
题目链接: A. Pouring Rain time limit per test 1 second memory limit per test 256 megabytes input standar ...
- [Codeforces667A]Pouring Rain(数学,几何)
题目链接:http://codeforces.com/contest/667/problem/A 题意:一个杯子里有水,一个人在喝并且同时在往里倒.问这个人能不能喝完,多久能喝完. 把相关变量都量化成 ...
- Codeforces Round #486-F.Rain and Umbrellas题解
一.题目链接:http://codeforces.com/contest/988/problem/F 二.题面 三.思路 很明显而且比较能想到的$dp$. 四.代码实现 #include<bit ...
- CodeForces 988 F Rain and Umbrellas
Rain and Umbrellas 题意:某同学从x=0的点走到x=a的点,路上有几段路程是下雨的, 如果他需要经过这几段下雨的路程, 需要手上有伞, 每一把伞有一个重量, 求走到重点重量×路程的最 ...
- CF667A Pouring Rain 题解
Content 一个水桶直径为 \(d\) 厘米,初始时水面高度为 \(h\) 厘米.你每秒钟喝 \(v\) 毫升水,而由于下雨,水桶里面的水在不喝水的时候每秒会上升 \(e\) 厘米.求你最少需要多 ...
- Codeforces Round #349
终于又回到熟悉的Round了 数学 A - Pouring Rain 设个未知数,解方程,还好没有hack点 #include <bits/stdc++.h> typedef long l ...
- BUPT2017 wintertraining(15) #1 题解
拖了一周才完成的题解,抛出一个可爱的表情 (っ'-')╮ =͟͟͞͞❤️.对我来说E.F比较难,都是线段树的题,有点久没写了. A - Infinite Sequence CodeForces - 6 ...
- English trip V1 - B 4.How Do You Make a Salad? 请给我一间房? Teacher:Julia Key:imperatives 祈使句
In this lesson you will learn to give instructions. 这节课你将将学会给出指示. 课上内容(Lesson) 词汇(Key Word ) bell pe ...
- 《三体》刘慈欣英文演讲:说好的星辰大海你却只给了我Facebook
美国当地时间2018日11月8日,著名科幻作家刘慈欣被授予2018年度克拉克想象力贡献社会奖(Clarke Award for Imagination in Service to Society),表 ...
随机推荐
- MVC :“已添加了具有相同键的项”
最近将一个项目从ASP.NET MVC 3升级至刚刚发布的ASP.NET MVC 5.1,升级后发现一个ajax请求出现了500错误,日志中记录的详细异常信息如下: System.ArgumentEx ...
- html5-本地数据库的操作
<script src="jquery-1.8.3.js"></script><script>/* IE11不支持此操作创建数据库 解释一下op ...
- homebrew osx下面最优秀的包管理工具
官方网站:https://brew.sh/index_zh-cn 安装 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubuserconten ...
- 单元测试时使用Ninject的小问题
主要是Kernel没有被释放,Ninject的Kernel必须调用IDispose释放.也有可能是静态类型在VS单元测试时无法被释放. 先记录下这个问题
- Ubuntu 14.04 下FTP服务器的搭建
FTP服务器的搭建,我要实现的需求是: 不允许匿名访问,因为我的机器不想让谁都能登录上来,随便获取文件, 需要锁定一个目录,因为在家里,我需要给媳妇下载一些电影 韩剧之类的东西,媳妇会来我机器下载,但 ...
- Jquery学习笔记(6)--jquery中attr和prop的区别【精辟】
jquery中attr和prop的区别 在高版本的jquery引入prop方法后,什么时候该用prop?什么时候用attr?它们两个之间有什么区别?这些问题就出现了. 关于它们两个的区别,网上的答案很 ...
- 逻辑漏洞-客户端验证的邮箱-Web渗透实例之中国教育部青少年普法网站逻辑漏洞
转载自:http://www.zmnhssn.com/?post=61 漏洞地址:https://user.qspfw.com 用户登陆界面 具体漏洞地址: 用户密码找回界面:https:// ...
- HTML5 的位置
HTML5 的位置 在HTML5COL学院的前面几个章节中我们已经对HTML5 Geolocation API有了一定认识,接下来我们要对位置做些更有意思的处理:看看你与我们HTML5COL学院的办公 ...
- Control.DataBinding数据绑定细解
在C#操作数据库过程中,针对一般的文本控件,比如TextBox,Label等,我们赋值直接使用类似TextBox.Text=****的方式 来进行,这种方式从某种意义上来说的确是最简便的方式,但是对于 ...
- java删除递归文件夹及文件夹下文件
public static void delUrlLocalFile(String urlPath) { File file = new File(urlPath); if(file.isDirect ...