文章

2

粉丝

169

获赞

0

访问

13.0k

头像
T和Y的计划
P1028
发布于2021年3月17日 16:03
阅读数 6.6k

#include<bits/stdc++.h>
using namespace std;
struct Point
{
    double x,y,z;
    Point():x(),y(),z(){}
    Point(double x,double y,double z):x(x),y(y),z(z){}
    Point operator -(const Point&a)
    {
        return Point(x-a.x,y-a.y,z-a.z);
    }
    Point operator +(const Point&a)
    {
        return Point(x+a.x,y+a.y,z+a.z);
    }
    Point operator /(const int &a)
    {
        return Point(x/a,y/a,z/a);
    }
    double distances(const Point &a)
    {
        Point data=*(this)-a;
        return pow(data.x,2)+pow(data.y,2)+pow(data.z,2);
    }
};
int main()
{
    int N;
    vector<Point>nums;
    Point t,y;
    scanf("%d",&N);
    while(N--)
    {
        scanf("%lf%lf%lf",&t.x,&t.y,&t.z);
        nums.push_back(t);
    }
    scanf("%lf%lf%lf",&t.x,&t.y,&t.z);
    scanf("%lf%lf%lf",&y.x,&y.y,&y.z);
    y=(t+y)/2;
    for(auto i:nums)
    {
        if(y.distances(t)>...
登录查看完整内容


登录后发布评论

暂无评论,来抢沙发