题解 | 球的半径和体积
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int a,b,c,x,y,z;
while(cin>>a>>b>>c>>x>>y>>z){
int r2=(x-a)*(x-a)+(y-b)*(y-b)+(z-c)*(z-c);
double r=sqrt(r2);
double v=4.0/3.0*acos(-1)*r*r2;
printf("%.3f %.3f",r,v);
}
}
这题应该是在考基础函数认识,数学库里面有算arccos的函数,acos
vivo公司氛围 351人发布
