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),表 ...
随机推荐
- Xilinx IP核使用(一)--FIFO
今天在将SRIO的数据存入FIFO后,然后把FIFO中的数据不断送入FFT进行运算时,对于几个控制信号总产生问题.所以单独对FIFO进行了仿真.原来感觉FIFO的几个参数端口一目了然啊,还需要什么深入 ...
- JS高程3:DOM-节点层次
DOM是一个API,通过该API可以操作HTML文档或者XML文档. DOM将HTML或者XML文档描绘成一个多层节点结构. 文档节点是HTML或者XML文档的根节点,同时也是其他节点的根节点,因为每 ...
- 李洪强和你一起学习前端之(8)CSS复习
今天是2017年3月24日周五 每一天都是余生当中最好的一天,珍惜当下. CSS基础复习 1 复习 1.1Css第一天 css层叠样式表 基础选择器 标签选择器 p{属性: 值;} 类选择器 .自定义 ...
- 在控制台快速定位js函数
最近在搞教务处的模拟登录,教务处用js加密密码和账号,为了构造能用的post数据,需要快速的找到对应的js代码.但是,那么多js代码,手动找会找到死的. 恰好学习了两个快速定位的方法:console ...
- DNSPod--国内最早提供免费智能DNS产品的网站,致力于为各类网站提供高质量的多线智能DNS免费解析
DNSPod 建立于2006年3月份,是一款免费智能DNS产品. DNSPod 可以为同时有电信.网通.教育网服务器的网站提供智能的解析,让电信用户访问电信的服务器,网通的用户访问网通的服务器,教育网 ...
- codeforces 825F F. String Compression dp+kmp找字符串的最小循环节
/** 题目:F. String Compression 链接:http://codeforces.com/problemset/problem/825/F 题意:压缩字符串后求最小长度. 思路: d ...
- 海康网络摄像机调用SDK解码Java版
两个回调函数: FRealDataCallBack 实现预览回调数据 DecCallBack 解码回调函数 在HCNetSDK.java补充相关函数和结构声明 //播放库函数声明,PlayCtrl.d ...
- jQuery实现浮动层跟随页面滚动效果
helloweba.com Author:月光光 Time:2010-11-29 09:02 Tag: jquery 滚动 在本文中,我将介绍一个可以跟随页面滚动的层效果,当用户滚动鼠标滚轮或者 ...
- C语言 百炼成钢27
/* 题目63:编写C++程序完成以下功能: (1)声明一个纯虚函数类Shape(形状),其中包含来计算面积.计算周长的方法: (2)从Shape派生两个类矩形和圆形: (3)从矩形派生正方形: (4 ...
- CVPR(IEEE Conference on Computer Vision and Pattern Recognition)
论文提交时间:11月份中旬左右会议时间:7月份左右 CVPR 2017: 网址:http://cvpr2017.thecvf.com/ 接受论文数:782