题意:给n个点的坐标的移动方向及速度,问在之后的时间的所有点的最大距离的最小值是多少。

思路:三分。两点距离是下凹函数,它们的max也是下凹函数。可以三分。

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<vector>
#define LL long long
#define MAXN 100005
using namespace std;
struct Point
{
    double x,y,vx,vy;
    Point(double a,double b,double c,double d):x(a),y(b),vx(c),vy(d) {}
};
vector<Point> vec;
double calc(double time)
{
    ;
    ; i<vec.size(); ++i)
        ; j<vec.size(); ++j)
        {
            double nx=vec[i].x+vec[i].vx*time,ny=vec[i].y+vec[i].vy*time;
            double mx=vec[j].x+vec[j].vx*time,my=vec[j].y+vec[j].vy*time;
            maxn=max(maxn,(sqrt((nx-mx)*(nx-mx)+(ny-my)*(ny-my))));
        }
    return maxn;

}
int main()
{
    ;
    scanf("%d",&T);
    while(T--)
    {
        int n;
        scanf("%d",&n);
        vec.clear();
        ;i<n;++i)
        {
            double a,b,c,d;
            scanf("%lf%lf%lf%lf",&a,&b,&c,&d);
            vec.push_back(Point(a,b,c,d));
        }
        ,R=1e8;
        ; i<; ++i)
        {
            ;
            ;
            if(calc(m1)<calc(m2)) R=m2;
            else L=m1;
        }
        printf("Case #%d: %.2lf %.2lf\n",++kase,L,calc(L));
    }
    ;
}

HDU 4717 The Moving Points (三分法)的更多相关文章

  1. HDU 4717 The Moving Points (三分)

    The Moving Points Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  2. HDU 4717 The Moving Points(三分法)(2013 ACM/ICPC Asia Regional Online ―― Warmup2)

    Description There are N points in total. Every point moves in certain direction and certain speed. W ...

  3. HDU 4717 The Moving Points(三分)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4717 题意:给出n个点的坐标和运动速度(包括方向).求一个时刻t使得该时刻时任意两点距离最大值最小. ...

  4. hdu 4717 The Moving Points(第一个三分题)

    http://acm.hdu.edu.cn/showproblem.php?pid=4717 [题意]: 给N个点,给出N个点的方向和移动速度,求每个时刻N个点中任意两点的最大值中的最小值,以及取最小 ...

  5. hdu 4717 The Moving Points(三分+计算几何)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4717 说明下为啥满足三分: 设y=f(x) (x>0)表示任意两个点的距离随时间x的增长,距离y ...

  6. hdu 4717 The Moving Points(三分)

    http://acm.hdu.edu.cn/showproblem.php?pid=4717 大致题意:给出每一个点的坐标以及每一个点移动的速度和方向. 问在那一时刻点集中最远的距离在全部时刻的最远距 ...

  7. hdu 4717: The Moving Points 【三分】

    题目链接 第一次写三分 三分的基本模板 int SanFen(int l,int r) //找凸点 { ) { //mid为中点,midmid为四等分点 ; ; if( f(mid) > f(m ...

  8. HDOJ 4717 The Moving Points

    The Moving Points Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  9. hdu4717 The Moving Points 三分法

    题意:坐标系上有n个点,每个点的坐标和移动方向速度告诉你,速度方向都是固定的.然后要求一个时刻,使得这个时刻,这些点中最远的距离最小. 做法:三分法,比赛的时候想不到.考虑两个点,如果它们走出来的路径 ...

随机推荐

  1. 初识Python第二天(1)

    在Python中,一切事物都是对象,对象是基于类创建的,对象继承了类的属性,方法等. 一.传递参数 1.1新建python文件,名为twoday_args.py,输出以下代码 import sys p ...

  2. PostgreSQL Hot Standby的主备切换

    一. 简介:          PG在9.*版本后热备提供了新的一个功能,那就是Stream Replication的读写分离,是PG高可用性的一个典型应用.其中备库是只读库:若主库出现故障:备库这个 ...

  3. css3实现轮播

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  4. Iptables防火墙

    1 位置 使用vim /usr/sysconfig/iptables 2 启动.关闭.保存 service iptables stop service iptables start service i ...

  5. Java 利用初学知识 写出自己的名字

  6. websphere如何删除应用程序服务器(概要管理工具)

    在IBM WebSphere 的概要管理工具中我们可以新建一个应用程序服务器,但是工具中并未提供删除已经建过的应用程序服务器.下面 交大家一个比较简单的方法来删除应用程序服务器 图片中可以看到,我已经 ...

  7. Cheatsheet: 2015 08.01 ~ 08.31

    Java Beginner's Guide to MVC with Spring Framework Exploring the Spring Web MVC for Web Application ...

  8. GIS服务器需求分析

    一. 需求概要 1 边界 核心职责 接收并存储外部各方系统GPS数据 GPS数据实时分发, 轨迹检索   2 流程 GIS客户端向GIS服务器订购 GIS客户端向GIS服务器订购号码(仅有号码这一项业 ...

  9. 【转载】协同过滤 & Spark机器学习实战

    因为协同过滤内容比较多,就新开一篇文章啦~~ 聚类和线性回归的实战,可以看:http://www.cnblogs.com/charlesblc/p/6159187.html 协同过滤实战,仍然参考:h ...

  10. asp获取虚拟目录根路径

    <% TempArray = Array("account_book","admin","ajaxFile","catalo ...