Country Meow

和这基本一样 https://www.cnblogs.com/Fighting-sh/p/9809518.html

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
using namespace std; struct Point{
double x,y,z;
}p[]; double dist(Point a,Point b){
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z));
} double ac(int n){
double ans=1e9;
Point tmp;
tmp.x=tmp.y=tmp.z=;;
int s=;
double step=;
double esp=0.0000001;
while(step>esp){
for(int i=;i<=n;i++){
if(dist(tmp,p[s])<dist(tmp,p[i])) s=i;
}
double Dist=dist(tmp,p[s]);
ans=min(ans,Dist);
tmp.x+=(p[s].x-tmp.x)/Dist*step;
tmp.y+=(p[s].y-tmp.y)/Dist*step;
tmp.z+=(p[s].z-tmp.z)/Dist*step;
step*=0.999;
}
return ans;
} int main(){
int n;
while(~scanf("%d",&n)){
if(!n) break;
for(int i=;i<=n;i++){
scanf("%lf %lf %lf",&p[i].x,&p[i].y,&p[i].z);
}
double ans=ac(n);
printf("%.5f\n",ans);
}
}

最新文章

  1. android 利用线程刷新UI方法
  2. ubuntu 设置 NAT 转发
  3. poj 2923 状压dp+01背包
  4. Qt 串口学习3
  5. Python开发【第一篇】:目录
  6. Html中版权符号的字体选择问题(如何让版权符号更美观)
  7. java中怎么判断一个字符串中包含某个字符或字符串
  8. CreateMutex
  9. 苹果浏览器Safari对JS函数库中newDate()函数中的参数的解析中不支持形如“2020-01-01”形式
  10. python函数(2):函数进阶
  11. expect免互交 常用编辑文本
  12. zsh 缺省输入设置
  13. 转 Ubuntu16.04+QT4.8.7开发环境搭建
  14. thymeleaf:访问list,map等
  15. 053 kafka自带的生产者与消费者测试
  16. 聊聊setTimeout和setInterval线程
  17. python五十八课——正则表达式(分组)
  18. SSH框架总结(环境搭建+框架分析+实例源码下载)
  19. iOS编程(双语版)-视图-Frame/Bounds/Center
  20. 神奇的照片修复术,这才是 PS 的正确打开方式!

热门文章

  1. 启动tornado项目,hello world
  2. input输入框外联式样式控制不了字体
  3. [置顶] Unity2d引入新功能SpriteAtlas,Sprite新的图集方式
  4. MPI2 编程环境搭建 MPI4PY 编程环境搭建
  5. test20181019 B君的第三题
  6. ballerina 学习十八 事务编程
  7. php在循环内外实例化类占用内存比较
  8. linux shell获取用户输入
  9. ruby里面module和class的区别
  10. APR介绍