题解 | #球的半径和体积#
球的半径和体积
https://www.nowcoder.com/practice/4b733a850c364c32b368555c8c2ec96b
#include <iostream> #include <cmath> using namespace std; int main() { int x0, y0, z0, x1, y1, z1; while (cin >> x0 >> y0 >> z0 >> x1 >> y1 >> z1) { double r = sqrt(pow(x0 - x1, 2) + pow(y1 - y0, 2) + pow(z0 - z1, 2)); double pi = acos(-1); printf("%.3lf %.3lf", r, 4.0/3*pi*pow(r, 3)); } }