九度OJ 1068 球半径和数量 (模拟)
时间:2015-09-27 17:31:08
收藏:0
阅读:23427
#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不能版权声明:本文博主原创文章,博客,未经同意不得转载。
原文:http://www.cnblogs.com/mengfanrong/p/4842390.html
评论(0)