九度OJ 题目1068:球的半径和体积
/********************************* * 日期:2013-1-31 * 作者:SJF0115 * 题号: 九度OJ 题目1068:球的半径和体积 * 来源:http://ac.jobdu.com/problem.php?pid=1068 * 结果:AC * 来源:2001年清华大学计算机研究生机试真题(第II套) * 总结:**********************************/ #include <stdio.h>#include <math.h>int main(){double x0,y0,z0,x1,y1,z1;while(scanf("%lf %lf %lf %lf %lf %lf",&x0,&y0,&z0,&x1,&y1,&z1) != EOF){double R,S;R = sqrt((x0 - x1)*(x0 - x1) + (y0 - y1)*(y0- y1) + (z0 - z1)*(z0 - z1));S = 4.0 / 3 * acos(-1) * R * R * R;printf("%.3lf %.3lf\n",R,S);}return 0;}