唔。

这道题的火候比较巧妙。

我们是每次找到一个最远的点,然后向那个最远点逼近。

这显然非常合理。

 #include <cstdlib>
#include <cmath>
#include <cstdio>
#include <algorithm> using namespace std;
typedef double db;
const db eps = 1e-;
const db delta = 0.98;
const db INF = 1e100;
db random(){
return (rand()&?:-)*rand()*1.0/;
}
struct P3{
db x,y,z;
P3 operator + (P3 k1){return (P3){x+k1.x,y+k1.y,z+k1.z};}
P3 operator - (P3 k1){return (P3){x-k1.x,y-k1.y,z-k1.z};}
P3 operator / (db k1){ return (P3){x/k1,y/k1,z/k1};}
P3 operator * (db k1){ return (P3){x*k1,y*k1,z*k1};}
db abs(){return sqrt(x*x+y*y+z*z);}
};
P3 p[];
int n;
db F(P3 x){
db res=;
for(int i=;i<n;i++){
res=max(res,(x-p[i]).abs());
}
return res;
}
db SA(){
db t = ;
db ans = INF;
P3 x = {,,};
while (t>eps){
db mx = ;int id=-;
for(int i=;i<n;i++){
if((x-p[i]).abs()>mx){
mx=(x-p[i]).abs();
id=i;
}
}
ans = min(ans,mx);
ans=mx;
x=x+(p[id]-x)/mx*t;
t*=delta;
}
printf("%.5f\n",ans);
}
int main(){
while (scanf("%d",&n)&&n){
for(int i=;i<n;i++){
scanf("%lf%lf%lf",&p[i].x,&p[i].y,&p[i].z);
}
SA();
}
}

poj 2069的更多相关文章

  1. poj 2069 Super Star——模拟退火(收敛)

    题目:http://poj.org/problem?id=2069 不是随机走,而是每次向最远的点逼近.而且也不是向该点逼近随意值,而是按那个比例:这样就总是接受,但答案还是要取min更新. 不知那个 ...

  2. poj 2069 Super Star —— 模拟退火

    题目:http://poj.org/problem?id=2069 仍是随机地模拟退火,然而却WA了: 看看网上的题解,都是另一种做法——向距离最远的点靠近: 于是也改成那样,竟然真的A了...感觉这 ...

  3. POJ 2069 Super Star

    模拟退火. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm& ...

  4. POJ 2069 模拟退火算法

    Super Star Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6422   Accepted: 1591   Spec ...

  5. POJ 2069 Super Star(计算几何の最小球包含+模拟退火)

    Description During a voyage of the starship Hakodate-maru (see Problem 1406), researchers found stra ...

  6. poj 2069 Super Star 模拟退火

    题目大意: 给定三位空间上的n(\(n \leq 30\))个点,求最小的球覆盖掉所有的点. 题解: 貌似我们可以用类似于二维平面中的随机增量法瞎搞一下 但是我不会怎么搞 所以我们模拟退火就好了啊QA ...

  7. 【POJ】2069.Super Star

    题解 求一个最小的半径的球,包括三维平面上所有的点,输出半径 随机移动球心,半径即为距离最远的点,移动的方式是向离的最远的那个点移动一点,之后模拟退火就好 代码 #include <iostre ...

  8. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  9. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

随机推荐

  1. java C 类自动转换规则

    C类型转换规则

  2. Linux进程管理学习资料

    下面是一些Linux进程管理相关的资料. 博客 Process Creation(一) Process Creation(二) 进程切换分析(1):基本框架 进程切换分析(2):TLB处理 When ...

  3. 国际化之iPhone设备支持的语种

    有没有想过,iPhone 语言到底支持多少语言呢?我倒是搜索了一下,整理出下面一份列表,供大家参考 参考链接: https://www.ibabbleon.com/iOS-Language-Codes ...

  4. Error-MVC: 未能找到路径“D:\\DsWeb\DS.Web\dist\bin\roslyn\csc.exe”的一部分。

    ylbtech-Error-MVC: 未能找到路径“D:\\DsWeb\DS.Web\dist\bin\roslyn\csc.exe”的一部分. 1.返回顶部 1, “/”应用程序中的服务器错误. 未 ...

  5. Chart:Grafana

    ylbtech-Chart:Grafana 1.返回顶部 1-1. 2.返回顶部   3.返回顶部   4.返回顶部   5.返回顶部 0. https://grafana.com/ 1. http: ...

  6. jQuery CSS 操作 - offset() 方法

    今天在一个页面需要知道jquery版本号,来决定使用什么样的方法,有以下方式可以获取到 $.fn.jquery $.prototype.jquery 这两种方式都可以获取到jquery的版本号 --- ...

  7. javascript 生成MD5加密

    进行HTTP网络通信的时候,调用API向服务器请求数据,有时为了防止API调用过程中被黑客恶意篡改,所请求参数需要进行MD5算法计算,得到摘要签名.服务端会根据请求参数,对签名进行验证,签名不合法的请 ...

  8. 每天一个linux命令(7):mv

    1.命令简介 mv(Move file)将源文件重命名为目标文件,或将源文件移动至指定目录.. 2.用法 mv [选项]... [-T] 源文件 目标文件 或:mv [选项]... 源文件... 目录 ...

  9. [转]The Production Environment at Google

    A brief tour of some of the important components of a Google Datacenter.   A photo of the interior o ...

  10. 基于 Python 官方 GitHub 构建 Python 文档

    最近在学 Python,所以总是在看 Python 的官方文档, https://docs.python.org/2/ 因为祖传基因的影响,我总是喜欢把这些文档保存到本地,不过 Python 的文档实 ...