题解 | 球的半径和体积
球的半径和体积
https://www.nowcoder.com/practice/4b733a850c364c32b368555c8c2ec96b
#include <iostream> #include <algorithm> #include <cmath> // #define PI arccos(-1) using namespace std; double PI = acos(-1); int main() { double x0,x1,y0,y1,z0,z1; cin>>x0>>y0>>z0>>x1>>y1>>z1; double a = (x0-x1)*(x0-x1)+(y0-y1)*(y0-y1)+(z0-z1)*(z0-z1); double r = sqrt(a); double vo = (4.0/3)*PI*r*r*r; printf("%.3lf %.3lf\n",r,vo); } // 64 位输出请用 printf("%lld")