OJ真的快,这么暴力都无压力过
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int T, t, x, y, z;
    int dot[100][3];
    double distance, mindistance=500000;
    cin>>T;
    t=T;
    while(t--) cin>>dot[t][0]>>dot[t][1]>>dot[t][2];
    for(int i=-50; i<51; i++)
        for(int j=-50; j<51; j++)
            for(int k=-50; k<51; k++)
            {
                distance=0;
                for(int a=0; a<T; a++) distance+=sqrt((dot[a][0]-i)*(dot[a][0]-i)+(dot[a][1]-j)*(dot[a][1]-j)+(dot[a][2]-k)*(dot[a][2]-k));
                if(distance<mindistance) {mindistance=distance; x=i; y=j; z=k;}
                else if(distance==mindistance)
                {
                    if(i<x) {mindistance=distance; x=i; y=j; z=k;}
                    else if(i==x && j<y) {mindistance=distance; x=i; y=j; z=k;}
                    else if(i==x && j==y && k<z) {mindistance=distance; x=i; y=j; z=k;}
                }
            }
    cout<<x<<' '<<y<<' '<<z<<endl;
    return 0;
}
 
         
         
         
        
可能是写法问题,,我用了long double才过,用double会蜜汁TLE
现在觉得,能一遍过真的是运气……