数学二分——cf700A
二分答案
#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的更多相关文章
- HDU 6216 A Cubic number and A Cubic Number(数学/二分查找)
题意: 给定一个素数p(p <= 1e12),问是否存在一对立方差等于p. 分析: 根据平方差公式: 因为p是一个素数, 所以只能拆分成 1*p, 所以 a-b = 1. 然后代入a = b + ...
- UVA 10668 - Expanding Rods(数学+二分)
UVA 10668 - Expanding Rods 题目链接 题意:给定一个铁棒,如图中加热会变成一段圆弧,长度为L′=(1+nc)l,问这时和原来位置的高度之差 思路:画一下图能够非常easy推出 ...
- Success Rate CodeForces - 807C (数学+二分)
You are an experienced Codeforces user. Today you found out that during your activity on Codeforces ...
- CF 483B. Friends and Presents 数学 (二分) 难度:1
B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input stand ...
- HDU 5646 DZY Loves Partition 数学 二分
DZY Loves Partition 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5646 Description DZY loves parti ...
- UVA 11881 Internal Rate of Return(数学+二分)
In finance, Internal Rate of Return (IRR) is the discount rate of an investment when NPV equals zero ...
- AtCoder Express(数学+二分)
D - AtCoder Express Time limit : 2sec / Memory limit : 256MB Score : 400 points Problem Statement In ...
- ACM学习历程—HDU5587 Array(数学 && 二分 && 记忆化 || 数位DP)(BestCoder Round #64 (div.2) 1003)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5587 题目大意就是初始有一个1,然后每次操作都是先在序列后面添加一个0,然后把原序列添加到0后面,然后 ...
- Codeforces Round #364 (Div. 2) D. As Fast As Possible 数学二分
D. As Fast As Possible 参考:https://blog.csdn.net/keyboardmagician/article/details/52769493 题意: 一群大佬要走 ...
随机推荐
- shell 输入输出重定向
1. 命令列表: command > file 将输出重定向到file command < file 将输入重定向到file command >> file 将输出以追加的方式 ...
- 百度链接提交主动推送 c#实现
说明:此方法适合百度站长,利用此方法可以第一时间将你的原创文章上传到百度,保护你的著作权,也可以帮你的网站进行引流 以下是代码实现: /// <summary> /// 提 ...
- BlueStore-先进的用户态文件系统《二》-BlueFS
https://zhuanlan.zhihu.com/p/46362124 简介 上一篇文章中,介绍了BlueStore的诞生背景.逻辑架构以及设计思想,提到了在BlueStore中元数据都是存放在R ...
- mac 格式化U盘
作者:Bailm链接:https://www.zhihu.com/question/27888608/answer/486347894来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载 ...
- src/lib/framework/src/driverFramework.cpp学习
int Framework::initialize() { DF_LOG_DEBUG("Framework::initialize"); g_framework = new Syn ...
- Cisco基础(二):三层交换vlan间通信、多交换机vlan间通信、三层交换配置路由、RIP动态路由配置、三层交换配置RIP动态路由
一.三层交换vlan间通信 目标: VLAN实现了广播域的隔离,同时也将VLAN间的通信隔离了.三层交换技术使得VLAN间可以通信. 通过三层交换实现VLAN间通信 方案: 为了解决了传统路由器低速. ...
- 为什么NULL能多次free
void __cdecl _free_base (void * pBlock) { int retval = 0; if (pBlock == NULL) ...
- python selenium模拟登陆163邮箱。
selenium是可以模拟浏览器操作. 有些爬虫是异步加载的,通过爬取网页源码是得不到需要的内容.所以可以模拟浏览器去登陆该网站进行爬取操作. 需要安装selenium通过pip install xx ...
- C++之前置自增与后置自增
关于前置自增与后置自增的区别我是参考这里:http://bbs.bccn.net/thread-454977-1-1.html 简单复述下,比如++x; 与 x++; 在C中,++x这个表达式的值为原 ...
- Tomcat_shutdown
@echo off echo 执行开始时间 date/t time/t echo *********************************************** echo 正在关闭To ...