文章
84
粉丝
408
获赞
33
访问
877.6k
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;
typedef struct Node{
double x;
double y;
double z;
}LNode;
int main()
{
int n;
LNode acm, future, midp;
vector<LNode> vct;
cin >> n;
for (int i = 0; i < n; i++) {
LNode point;
cin >> point.x >> point.y >> point.z;
vct.push_back(point);
}
cin >> acm.x >> acm.y >> acm.z;
cin >> future.x >> future.y >> future.z;
midp.x = (acm.x + future.x)/2.0;
midp.y = (acm.y + future.y)/2.0;
midp.z = (acm.z + future.z)/2.0;
int index = 0;//记录heart序号
double midd = sqrt((vct[0].x-midp.x)*(vct[0].x-midp.x) + (vct[0].y-midp.y)*(vct[0].y-midp.y) + (vct[0].z-midp.z)*(vct[0].z-midp.z));
;//记录最小距离
for (int i = 1; i < n; i++) {
double dis = sqrt((vct[i].x-midp.x)*(vct[i].x-midp.x) + (vct[i].y-midp.y)*(vct[i].y-midp.y) + (vct[i].z-midp.z)*(vct[i].z-midp.z));
if (dis...
登录后发布评论
太强了吧