CodeForces - 667A
来源:互联网 发布:申请淘宝介入在哪里 编辑:程序博客网 时间:2024/05/29 18:32
Description
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 equalsh 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 one 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 after104 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 exceed104.
Sample Input
1 2 3 100
NO
1 1 1 1
YES3.659792366325
Sample Output
Hint
Source
#include<stdio.h>#include<math.h>#define jj acos(-1.0)int main(){double k;double d,h,v,e;scanf("%lf%lf%lf%lf",&d,&h,&v,&e);k=jj*(d/2.0)*(d/2.0)*h;e=jj*(d/2.0)*(d/2.0)*e;if(v<=e)printf("NO\n");else{printf("YES\n");printf("%lf\n",k/(v-e));}}
- CodeForces - 667A
- codeforces 667A 667B
- codeforces 667A A. Pouring Rain(水题)
- CodeForces 667A Pouring Rain
- CodeForces 667A Pouring Rain
- 【Codeforces】-#667A- Pouring Rain
- CodeForces-a
- Codeforces 903A A
- 【CodeForces】667A - Pouring Rain(数学)
- CodeForces 18A A - Triangle
- CodeForces 133A A. HQ9+
- codeforces 651A A. Joysticks
- 【Codeforces 597A】A. Divisibility
- 【 Codeforces 615A】A. Bulbs
- A. Divisibility CodeForces 597A
- codeforces 417A A. Elimination
- CodeForces 534A A. Exam
- codeforces#98 a
- 浅谈权限设计
- Linux定时任务crontab执行脚本出错
- 集成与派生——统计班长信息
- wuzhicms后台菜单的添加
- go数组作为函数参数传递
- CodeForces - 667A
- HTTP协议头
- js获取当前日期的前后N天日期的方法.html
- 虚函数,虚析构函数,纯虚函数,多态性,抽象类。
- C++上机作业6
- Python爬虫(一)
- springMVC 接收阿里回调接口
- 【REACT NATIVE 系列教程之七】统一ANDROID与IOS两个平台的程序入口&&区分平台的组件简介
- js使用window.open打开新页面