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),表 ...
随机推荐
- Hibernate JPA实体继承的映射(二) @MappedSuperclass
基于代码复用和模型分离的思想,在项目开发中使用JPA的@MappedSuperclass注解将实体类的多个属性分别封装到不同的非实体类中. 1.@MappedSuperclass注解只能标准在类上:@ ...
- SpringCloud系列十七:Hystrix的监控
1. 回顾 上文讲解了使用Hystrix为Feign添加回退,并通过Fallback Factory检查回退原因以及如何为Feign客户端禁用Hystrix. 2. Hystrix的监控 除实现容错外 ...
- Android-->Realm(数据库ORM)使用体验,lambda表达式
Realm,为移动设备而生.替代 SQLite 和 Core Data. 非常庆幸,官方帮助文档有中文: https://realm.io/cn/docs/java/latest/ 尽管眼下最新的版本 ...
- NGUI ScrollView中的Bounds
获取到的Bounds值是固定的,是因为Bounds区域的计算是被动计算,需要主动调用使其刷新 scrollView.InvalidateBounds(); 另外Bounds的Min和Max似乎和NGU ...
- datatables 相关文章
http://blog.csdn.net/zhu_xiao_yuan/article/details/51252300 datatables参数配置详解 http://blog.csdn.net/j ...
- 在linux下编译运行C++程序
头一回...把windows下的程序挪到linux下,代码见这篇随笔 1.编译ZTHREAD,使用./configure失败,直接编译的,方法还是上面提到的那篇随笔 2.编译源码,最开始用的cc,后来 ...
- 截图工具gsnap
嵌入式linux截图工具的基本原理就是通过读取Framebuffer,把LCD上显示的内容转换成图片格式文件(jpeg.bmp.png). gsnap.bin 1.jpg /dev/fb0 gsna ...
- Xcode 调试方法总结
前言:编写代码过程中出现错误.异常是不可避免的.通常我们都需要进行大量的调试去寻找.解决问题.这时,熟练掌握调试技巧将很大程度上的提高工作效率.接下来就说说开发过程中Xcode的调试方法. 1. En ...
- 爬虫 (4)- Selenium与PhantomJS(chromedriver)与爬取案例
Selenium文档 Selenium是一个Web的自动化测试工具,最初是为网站自动化测试而开发的,类型像我们玩游戏用的按键精灵,可以按指定的命令自动操作,不同是Selenium 可以直接运行在浏览器 ...
- 极光Java后台推送APP对接
1.极光对接,首先需要注册用户,和创建应用 2,.Java对接需要依赖包 <dependency> <groupId>cn.jpush.api</groupId> ...