Sample Input
5 1062.961900 47382.348900 49636.324000 21829.052500 75418.119200 6862.009300 24339.931000 6028.722000 27365.733500 20111.459200 22797.250400 42073.367900 29601.644400 39841.340000 55461.667800 21829.052500 75418.119200 6862.009300 20111.459200 22797.250400 42073.367900
Sample Output
21829.053 75418.119 6862.009 # include<stdio.h> # include<math.h> int main() { int n,i,j; double x[5000],y[5000],z[5000],a,b,c,t,d,f,g;double m[5000]; scanf("%d",&n); for(i=0;i<n+2;i++) scanf("%lf %lf %lf",&x[i],&y[i],&z[i]); a=(x[n+1]+x[n])/2; b=(y[n+1]+y[n])/2; c=(z[n+1]+z[n])/2; for(i=0;i<n;i++) { m[i]=sqrt((x[i]-a)*(x[i]-a)+(y[i]-b)*(y[i]-b)+(z[i]-c)*(z[i]-c)); } for(j=1;j<=n;j++) for(i=0;i<n-1;i++) if(m[i]>m[i+1]) { t=m[i]; m[i]=m[i+1]; m[i=1]=t; d=x[i]; x[i]=x[i+1]; x[i+1]=d; f=y[i]; y[i]=y[i+1]; y[i+1]=f; g=z[i]; z[i]=z[i+1]; z[i+1]=g; } printf("%.3lf %.3lf %.3lf\n",x[0],y[0],z[0]); return 0; } 可是我的答案是下面这样的