思路
球的半径为球心到球上一点的距离,,球的体积为
#include<iostream> #include<cmath> #include <iomanip> using namespace std; int main(){ 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/3.0*acos(-1)*pow(r, 3); cout << setprecision(3) << fixed << r << " " << v; } return 0; }