题目1068:球的半径和体积
#include<stdio.h>
#include<math.h>
double X0,Y0,Z0,X1,Y1,Z1;
void solve(){
double pi=acos(-1);//arccos在c里头就是acos
double r;
double v;
r=sqrt(pow(fabs(X1-X0),2)+pow(fabs(Y1-Y0),2)+pow(fabs(Z1-Z0),2));
v=4.0/3*pi*pow(r,3);
printf("%.3lf %.3lf\n",r,v);
}
int main(int argc, char *argv[])
{
//freopen("1068.in", "r", stdin);
while(~scanf("%lf %lf %lf %lf %lf %lf",&X0,&Y0,&Z0,&X1,&Y1,&Z1))
{
solve();
}
return 0;
}
/**************************************************************
Problem: 1068
User: kirchhoff
Language: C
Result: Accepted
Time:10 ms
Memory:1004 kb
****************************************************************/
注意float是ac不了的