AC日记——The Meeting Place Cannot Be Changed codeforces 780b
780B - The Meeting Place Cannot Be Changed
思路:
二分答案;
代码:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; #define eps 1e-7
#define INF 1e18
#define maxn 60005 int n; double xi[maxn],sp[maxn]; bool check(double ti)
{
double l=-INF,r=INF;
for(int i=;i<=n;i++)
{
l=max(l,xi[i]-sp[i]*ti);
r=min(r,xi[i]+sp[i]*ti);
}
if(l<=r) return true;
else return false;
} int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++) scanf("%lf",&xi[i]);
for(int i=;i<=n;i++) scanf("%lf",&sp[i]);
double l=,r=1e9,ans;
while(l<=r)
{
double mid=(l+r)/2.0;
if(check(mid)) r=mid-eps,ans=mid;
else l=mid+eps;
}
printf("%.7lf",ans);
return ;
}
AC日记——The Meeting Place Cannot Be Changed codeforces 780b的更多相关文章
- codeforces 782B The Meeting Place Cannot Be Changed (三分)
The Meeting Place Cannot Be Changed Problem Description The main road in Bytecity is a straight line ...
- AC日记——codevs1688求逆序对
AC日记--codevs1688求逆序对 锵炬 掭约芴巷 枷锤霍蚣 蟠道初盛 到被他尽情地踩在脚下蹂躏心中就无比的兴奋他是怎么都 ㄥ|囿楣 定要将他剁成肉泥.挫骨扬灰跟随着戴爷这么多年刁梅生 圃鳋 ...
- code force 403B.B. The Meeting Place Cannot Be Changed
B. The Meeting Place Cannot Be Changed time limit per test 5 seconds memory limit per test 256 megab ...
- Cf Round #403 B. The Meeting Place Cannot Be Changed(二分答案)
The Meeting Place Cannot Be Changed 我发现我最近越来越zz了,md 连调程序都不会了,首先要有想法,之后输出如果和期望的不一样就从输入开始一步一步地调啊,tmd现在 ...
- Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) B. The Meeting Place Cannot Be Changed
地址:http://codeforces.com/contest/782/problem/B 题目: B. The Meeting Place Cannot Be Changed time limit ...
- Codeforces 782B The Meeting Place Cannot Be Changed(二分答案)
题目链接 The Meeting Place Cannot Be Changed 二分答案即可. check的时候先算出每个点可到达的范围的区间,然后求并集.判断一下是否满足l <= r就好了. ...
- codeforces 782B The Meeting Place Cannot Be Changed+hdu 4355+hdu 2438 (三分)
B. The Meeting Place Cannot Be Change ...
- CodeForce-782B The Meeting Place Cannot Be Changed(高精度二分)
https://vjudge.net/problem/CodeForces-782B B. The Meeting Place Cannot Be Changed time limit per tes ...
- B. The Meeting Place Cannot Be Changed
B. The Meeting Place Cannot Be Changed time limit per test 5 seconds memory limit per test 256 megab ...
随机推荐
- 阿里巴巴Java开发规约Eclipse插件安装及使用
技术交流群:233513714 插件安装 环境:JDK1.8,Eclipse4+.有同学遇到过这样的情况,安装插件重启后,发现没有对应的菜单项,从日志上也看不到相关的异常信息,最后把JDK从1.6升级 ...
- 实现jQuery的$.extend方法
var o1 = { hello : 1, old : 555 }, o2 = { abc : 55555555, hello : 2, fun : function() { alert(111); ...
- Vim常用指令总结(持续更新中)
1 模式变更 命令 说明 a(append)/i(insert) 普通模式→插入模式 : 普通模式→命令行模式 ESC或者Ctrl 插入模式→普通模式 R(Replace)/Insert两次 普通模式 ...
- CSU-2110 Keeping Cool
题目链接 http://acm.csu.edu.cn:20080/csuoj/problemset/problem?pid=2110 题目 Description Kevin has just got ...
- HDU 4189 Cybercrime Donut Investigation 线段树+思路
参考:http://www.cnblogs.com/slon/archive/2012/03/30/2426104.html 题意:给一个有n个点的点集,有q个询问,每个询问询问一个点p,求与p曼哈顿 ...
- 团队项目-第九次scrum 会议
时间:11.5 时长:40分钟 地点:F楼1039教室 工作情况 团队成员 已完成任务 待完成任务 解小锐 完成员工commit函数的数值函数编写 完成多种招聘方式的逻辑编写 陈鑫 实现游戏的暂停功能 ...
- lombok 去除麻烦的实体类get和set,toString书写
首先在pom.xml中添加 <dependency> <groupId>org.projectlombok</groupId> <artifactId> ...
- Java性能监控之Instrumentation
注:网上摘取的资料整理出来,供大家学习理解,希望有所帮助. 1.1. Instrumentation 简介 利用 Java 代码,即 java.lang.instrument 做动态 Ins ...
- [洛谷P4149][IOI2011]Race
题目大意:给一棵树,每条边有边权.求一条简单路径,权值和等于$K$,且边的数量最小. 题解:点分治,考虑到这是最小值,不满足可减性,于是点分中的更新答案的地方计算重复的部分要做更改,就用一个数组记录前 ...
- golang effective 翻译
参考 Effective Go 官方文档 其他参考译文 https://studygolang.com/articles/3228 http://docscn.studygolang.com/doc/ ...