题解 | #球的半径和体积#
球的半径和体积
https://www.nowcoder.com/practice/4b733a850c364c32b368555c8c2ec96b
#include <bits/stdc++.h> #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(abs(((x1-x0)*(x1-x0) + (y1-y0)*(y1-y0) + (z1-z0)*(z1-z0)))); double v = (4 * acos(-1) * pow(r,3)) / 3; printf("%.3lf %.3lf",r,v); } }
1.立体两点距离公式
2.acos(-1)等于pai