题解 | #球的半径和体积#
球的半径和体积
https://www.nowcoder.com/practice/4b733a850c364c32b368555c8c2ec96b
#include<iostream> #include<cstdio> #include<math.h> using namespace std; int main(void) { int x0,y0,z0,x1,y1,z1; while(cin >> x0 >> y0 >> z0 >> x1 >> y1 >> z1) { double r = sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0) + (z1 - z0) * (z1 - z0)); double v = 4.0 / 3 * acos(-1) * r * r * r; printf("%.3f %.3f\n",r,v); } return 0; }