AC代码:
#include<stdio.h> #include<math.h> int main() { double P=acos(-1); double x0,y0,z0,x1,y1,z1; while(scanf("%lf %lf %lf %lf %lf %lf",&x0,&y0,&z0,&x1,&y1,&z1)!=EOF) { double S,V,R; R=sqrt(pow(x0-x1,2)+pow(y0-y1,2)+pow(z0-z1,2)); S=4.0*P*pow(R,2); V=4.0/3.0*P*pow(R,3); printf("%.3lf %.3lf ",R,V); } return 0; }