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的更多相关文章

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

  2. AC日记——codevs1688求逆序对

    AC日记--codevs1688求逆序对 锵炬 掭约芴巷 枷锤霍蚣 蟠道初盛 到被他尽情地踩在脚下蹂躏心中就无比的兴奋他是怎么都 ㄥ|囿楣 定要将他剁成肉泥.挫骨扬灰跟随着戴爷这么多年刁梅生 圃鳋 ...

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

  4. Cf Round #403 B. The Meeting Place Cannot Be Changed(二分答案)

    The Meeting Place Cannot Be Changed 我发现我最近越来越zz了,md 连调程序都不会了,首先要有想法,之后输出如果和期望的不一样就从输入开始一步一步地调啊,tmd现在 ...

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

  6. Codeforces 782B The Meeting Place Cannot Be Changed(二分答案)

    题目链接 The Meeting Place Cannot Be Changed 二分答案即可. check的时候先算出每个点可到达的范围的区间,然后求并集.判断一下是否满足l <= r就好了. ...

  7. codeforces 782B The Meeting Place Cannot Be Changed+hdu 4355+hdu 2438 (三分)

                                                                   B. The Meeting Place Cannot Be Change ...

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

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

随机推荐

  1. Apache 多端口配置方法

    首先修改httpd.conf配置文件. 添加8080端口 Listen 8080 打开虚拟配置文件 # Virtual hosts Include conf/extra/httpd-vhosts.co ...

  2. centos 服务器内存管理 服务于端口状态

    du su /目录/ 查看改目录大小 ls -lht /  查看文件详情,显示文件大小(直观) df -h 查看系统内存占用情况 centos 版本 lsb_release -a cat /etc/i ...

  3. iOS笔记056 - UI总结02

    九宫格布局 UICollectionViewController 创建控制器一定要指定默认的布局样式. // 加载一个九宫格布局的控制器,必须指定布局样式 UICollectionViewFlowLa ...

  4. 【Python】Django学习一:第一个Django程序

    项目开发环境 Python 3.6 Django 1.11.5 Django安装 在开始安装Django之前,Django更新比较频繁,所以要选择合适的版本,这里选择Django1.11.5. pip ...

  5. Kotlin中的“忍者”函数 —— 理解泛型的能力(KAD 12)

    作者:Antonio Leiva 时间:Feb 8, 2017 原文链接:https://antonioleiva.com/generic-functions-kotlin/ Kotlin的一些特性组 ...

  6. python selenium 练习 自动获取豆瓣阅读当前特价书籍 chrome 元素定位 窗口切换 元素过期

    豆瓣原创电子书每周推出数十本限时免费数目,一周免费期过后恢复原价.想着豆瓣原创书中有不少值得一看,便写了个脚本,免去一个个添加的烦恼. 使用了Windows下selenium+Python的组合,有较 ...

  7. Edu 0空投合约源码

    https://etherscan.io/address/0xa0872ee815b8dd0f6937386fd77134720d953581#code pragma solidity ^0.4.18 ...

  8. shell之dialog提示窗口

    dialog 提示窗口 1.msgbox     dialog --msgbox text 20 10 2.yesno     dialog --title "Please answer&q ...

  9. hadoop-hdfs(三)

    HDFS概念 1 数据块* HDFS的一个数据块默认是64M,与元数据分开管理. 优点: 数据块的大小设计的较大,所以寻址占传输的时间比例较小,只需要计算传输速度即可. 便于简化管理,利于计算剩余空间 ...

  10. CSLM 配置粗解

    CSLM工具(continuous space language model toolkit)用于训练NNLM,支持SRILM.KENLM(默认)语言模型工具,CUDA加速,CSTM统计机器翻译. 本 ...