Content

一个水桶直径为 \(d\) 厘米,初始时水面高度为 \(h\) 厘米。你每秒钟喝 \(v\) 毫升水,而由于下雨,水桶里面的水在不喝水的时候每秒会上升 \(e\) 厘米。求你最少需要多少秒才能喝完水桶里面的水,或者你喝水的速度赶不上水桶里面的水增多的速度。

数据范围:\(1\leqslant d,h,v,e\leqslant 10^4\)。

Solution

我们都知道,圆柱的底面积 \(S=\pi r^2=\pi(\dfrac{d}{2})^2=\dfrac{\pi d^2}{4}\),那么原来水的体积 \(V=Sh=\dfrac{\pi d^2h}{4}\)。

由于这里说的是水桶里的水每秒上升的高度,所以我们需要转化成体积为 \(\dfrac{\pi d^2e}{4}\)。然后我们在拿这个和 \(v\) 比较,如果 \(v\leqslant \dfrac{\pi d^2e}{4}\),那么你喝水的速度赶不上水桶里面的水增多的速度,不能喝完里面的水,否则答案就是 \(\dfrac{\dfrac{\pi d^2h}{4}}{v-\dfrac{\pi d^2e}{4}}=\dfrac{\dfrac{\pi d^2h}{4}}{\dfrac{4v-\pi d^2e}{4}}=\dfrac{\pi d^2h}{4v-\pi d^2e}=\dfrac{h}{\dfrac{4v}{\pi d^2}-e}\)。

Code

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
using namespace std; const double pi = acos(-1.0);
double d, h, v, e; int main() {
scanf("%lf%lf%lf%lf", &d, &h, &v, &e);
if(v <= d * d / 4.0 * pi * e) return printf("NO"), 0;
printf("YES\n%.12lf", h / (4.0 * v / (pi * d * d) - e));
return 0;
}

CF667A Pouring Rain 题解的更多相关文章

  1. CodeForces 667A Pouring Rain

    A. Pouring Rain time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  2. codeforces 667A A. Pouring Rain(水题)

    题目链接: A. Pouring Rain time limit per test 1 second memory limit per test 256 megabytes input standar ...

  3. [Codeforces667A]Pouring Rain(数学,几何)

    题目链接:http://codeforces.com/contest/667/problem/A 题意:一个杯子里有水,一个人在喝并且同时在往里倒.问这个人能不能喝完,多久能喝完. 把相关变量都量化成 ...

  4. BUPT2017 wintertraining(15) #1 题解

    拖了一周才完成的题解,抛出一个可爱的表情 (っ'-')╮ =͟͟͞͞❤️.对我来说E.F比较难,都是线段树的题,有点久没写了. A - Infinite Sequence CodeForces - 6 ...

  5. Codeforces Round #349

    终于又回到熟悉的Round了 数学 A - Pouring Rain 设个未知数,解方程,还好没有hack点 #include <bits/stdc++.h> typedef long l ...

  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 ...

  7. 《三体》刘慈欣英文演讲:说好的星辰大海你却只给了我Facebook

    美国当地时间2018日11月8日,著名科幻作家刘慈欣被授予2018年度克拉克想象力贡献社会奖(Clarke Award for Imagination in Service to Society),表 ...

  8. 【题解】【直方图】【Leetcode】Trapping Rain Water

    Given n non-negative integers representing an elevation map where the width of each bar is 1, comput ...

  9. [LeetCode]题解(python):042-Trapping Rain Water

    题目来源 https://leetcode.com/problems/trapping-rain-water/ Given n non-negative integers representing a ...

随机推荐

  1. oracle和mysql的拼接查询

    oracle的 SELECT * FROM sys_user a WHERE 1=1 AND a.company_id || a.login_name IN('3001rddb414') 196676 ...

  2. 『与善仁』Appium基础 — 15、使用Appium的第一个Demo

    我们使用Python语言作为测试脚本的编写语言. 执行脚本前提: Android模拟器或者手机是开机状态. 使用确保电脑和Android设备进行了链接. 也就是使用ADB命令adb connect链接 ...

  3. 洛谷 P4931 - [MtOI2018]情侣?给我烧了!(加强版)(组合数学)

    洛谷题面传送门 A 了这道题+发这篇题解,就当过了这个七夕节吧 奇怪的过节方式又增加了 首先看到此题第一眼我们可以想到二项式反演,不过这个 \(T\) 组数据加上 \(5\times 10^6\) 的 ...

  4. 【豆科基因组】大豆(Soybean, Glycine max)经典文章梳理2010-2020

    目录 2010年1月:大豆基因组首次发表(Nature) 2010年12月:31个大豆基因组重测序(Nature Genetics) 2014年10月:野生大豆泛基因组(Nature Biotechn ...

  5. 53-Linked List Cycle II

    Linked List Cycle II My Submissions QuestionEditorial Solution Total Accepted: 74093 Total Submissio ...

  6. acupuncture

    acute+puncture. [woninstitute.edu稻糠亩] To understand the basics of acupuncture, it is best to familia ...

  7. 什么是 IP 地址 – 定义和解释

    IP 地址定义 IP 地址是一个唯一地址,用于标识互联网或本地网络上的设备.IP 代表"互联网协议",它是控制通过互联网或本地网络发送的数据格式的一组规则. 本质上,IP 地址是允 ...

  8. ALitum技巧

    创建异型焊盘的方法 SCH与PCB同步修改后元器件乱跑的解决方法 Altium 在PCB重新编号更新到SCH原理图的方法 同步问题 其他技巧: 当前层亮色,其他层灰色切换:SHIFT+S

  9. C++ 之杂记

    今天做了一个题,代码不难,但是编译的时候就恼火,老是报错,也不告诉我错哪了.... 之前的代码是这样的,在main函数中调用这个类的构造函数,就一直报错,但是不知道原因,后来加上了const 就好了. ...

  10. 用UIScrollview做一个网易scrollviewbar

    效果如上,点击出现的图片是用UIImageview添加上的,比较简陋 我用了两种方法,第一种是直接在viewcontroller里面写代码 第二种是用了一个类来封装这个scrollviewbar 对外 ...