二分答案

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n,l,v1,v2,k;
double judge(double mid){//在mid时间内走完
if(mid*v2<l)return ;
double t=mid-(v2*mid-l)/(v2-v1);//每人坐车t分钟
double rt=t*(v2-v1)/(v1+v2);//回去的时间
int num=n/k;//送的批数
if(n%k)num++;
double tot=num*t+(num-)*rt;
if(tot<mid)return ;
return ;
} int main(){
cin>>n>>l>>v1>>v2>>k;
double L=,R=1e10,ans,mid;
while(R-L>1e-){
mid=(L+R)/;
if(judge(mid))
ans=mid,R=mid;
else L=mid;
}
printf("%.10lf\n",ans);
}

数学二分——cf700A的更多相关文章

  1. HDU 6216 A Cubic number and A Cubic Number(数学/二分查找)

    题意: 给定一个素数p(p <= 1e12),问是否存在一对立方差等于p. 分析: 根据平方差公式: 因为p是一个素数, 所以只能拆分成 1*p, 所以 a-b = 1. 然后代入a = b + ...

  2. UVA 10668 - Expanding Rods(数学+二分)

    UVA 10668 - Expanding Rods 题目链接 题意:给定一个铁棒,如图中加热会变成一段圆弧,长度为L′=(1+nc)l,问这时和原来位置的高度之差 思路:画一下图能够非常easy推出 ...

  3. Success Rate CodeForces - 807C (数学+二分)

    You are an experienced Codeforces user. Today you found out that during your activity on Codeforces ...

  4. CF 483B. Friends and Presents 数学 (二分) 难度:1

    B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input stand ...

  5. HDU 5646 DZY Loves Partition 数学 二分

    DZY Loves Partition 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5646 Description DZY loves parti ...

  6. UVA 11881 Internal Rate of Return(数学+二分)

    In finance, Internal Rate of Return (IRR) is the discount rate of an investment when NPV equals zero ...

  7. AtCoder Express(数学+二分)

    D - AtCoder Express Time limit : 2sec / Memory limit : 256MB Score : 400 points Problem Statement In ...

  8. ACM学习历程—HDU5587 Array(数学 && 二分 && 记忆化 || 数位DP)(BestCoder Round #64 (div.2) 1003)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5587 题目大意就是初始有一个1,然后每次操作都是先在序列后面添加一个0,然后把原序列添加到0后面,然后 ...

  9. Codeforces Round #364 (Div. 2) D. As Fast As Possible 数学二分

    D. As Fast As Possible 参考:https://blog.csdn.net/keyboardmagician/article/details/52769493 题意: 一群大佬要走 ...

随机推荐

  1. leetcode-166周赛-5280-用户分组

    题目描述: 自己的提交: class Solution: def groupThePeople(self, groupSizes: List[int]) -> List[List[int]]: ...

  2. UVa 11384 (推公式+递归)

    题目: 给你1到n,现在让你将每个数变成0,每一步操作可以选取任意数一起减去一个整数,减完了不能为负数!问你最少需要几步? 巨水的题,然而为什么要写博客呢?提醒自己要记得递归函数,不要傻傻的开数组硬比 ...

  3. window.open 打开新窗口被拦截的解决方案

    最近公司开发的一个项目,平凡用到下载各种类型的文件,但是例如.txt,.jpg,.pdf格式的文件呢浏览器会在当前窗口直接打开,影响用户体验,尝试各种方案和百度总结一下几点: 原理: 当window. ...

  4. mysql全家桶(二)数据操作

    一.数据操作1.增#新增insert into 表名(字段列表) values(值列表);INSERT INTO table_name ( field1, field2,...fieldN ) VAL ...

  5. 启发式分治:2019牛客多校第三场 G题 Removing Stones

    问题可以转换为求有多少个区间数字的总和除2向下取整大于等于最大值.或者解释为有多少个区间数字的总和大于等于最大值的两倍(但是若区间数字总和为奇数,需要算作减1) 启发式分治: 首先按最大值位置分治,遍 ...

  6. 微服务架构 技能图谱skill-map

    # 微服务架构 技能图谱 ## 理论基础### 概念#### 多微合适 - 非代码函数 - 非重写时间 - 适合团队最重要 - 独立业务属性 - 全功能团队 #### 进程隔离 - 服务运行在独立的进 ...

  7. 机器学习之KNN---k最近邻算法-机器学习

    KNN算法是机器学习中入门级算法,属于监督性学习算法.SupervisedLearning. 通过Plinko游戏来介绍该算法. 就是随机在上面投球,然后球进下面的哪个地方就得多少分. 然后在规定得投 ...

  8. Hive 数据类型转换(转)

    原文连接:https://www.iteblog.com/archives/892.html 在<Hive内置数据类型>文章中,我们提到了Hive内置数据类型由基本数据类型和复杂数据类型组 ...

  9. Sublime text 3 3103 注册码(2016.2.9更新)

    Sublime text 3 (Build 3103) license key,these all tested available on 2016/02/10 .Feel free to enjoy ...

  10. Flask-Restless初步了解

    Flask-Restless是Flask框架的一个扩展库 1. 功能介绍      通过使用SQLAlchemy或Flask-SQLAlchemy框架定义的数据库模型,提供一个简单的ReSTful A ...