九度oj-1068-球的半径和体积
2017-06-25 19:35
211 查看
题目描述:
输入球的中心点和球上某一点的坐标,计算球的半径和体积
输入:
球的中心点和球上某一点的坐标,以如下形式输入:x0 y0 z0 x1 y1 z1
输出:
输入可能有多组,对于每组输入,输出球的半径和体积,并且结果保留三位小数
样例输入:
样例输出:
AC1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
double x0,y0,z0;
double x1,y1,z1;
double r,v;
double pi=acos(-1);
while(scanf("%lf %lf %lf %lf %lf %lf",&x0,&y0,&z0,&x1,&y1,&z1) !=EOF ){
r=sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0)+(z1-z0)*(z1-z0));
v=(4.0/3)*pi*r*r*r;
printf("%.3lf %.3lf\n",r,v);
}
return 0 ;
}
/**************************************************************
Problem: 1068
User: 人气呆毛选手
Language: C
Result: Accepted
Time:10 ms
Memory:912 kb
****************************************************************/
AC2
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
double x0,y0,z0;
double x1,y1,z1;
double r,v;
double pi=acos(-1);
while(scanf("%lf %lf %lf %lf %lf %lf",&x0,&y0,&z0,&x1,&y1,&z1) !=EOF ){
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);
}
return 0 ;
}
/**************************************************************
Problem: 1068
User: 人气呆毛选手
Language: C
Result: Accepted
Time:10 ms
Memory:1004 kb
****************************************************************/
输入球的中心点和球上某一点的坐标,计算球的半径和体积
输入:
球的中心点和球上某一点的坐标,以如下形式输入:x0 y0 z0 x1 y1 z1
输出:
输入可能有多组,对于每组输入,输出球的半径和体积,并且结果保留三位小数
样例输入:
0 0 0 1 1 1
样例输出:
1.732 21.766
AC1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
double x0,y0,z0;
double x1,y1,z1;
double r,v;
double pi=acos(-1);
while(scanf("%lf %lf %lf %lf %lf %lf",&x0,&y0,&z0,&x1,&y1,&z1) !=EOF ){
r=sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0)+(z1-z0)*(z1-z0));
v=(4.0/3)*pi*r*r*r;
printf("%.3lf %.3lf\n",r,v);
}
return 0 ;
}
/**************************************************************
Problem: 1068
User: 人气呆毛选手
Language: C
Result: Accepted
Time:10 ms
Memory:912 kb
****************************************************************/
AC2
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
double x0,y0,z0;
double x1,y1,z1;
double r,v;
double pi=acos(-1);
while(scanf("%lf %lf %lf %lf %lf %lf",&x0,&y0,&z0,&x1,&y1,&z1) !=EOF ){
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);
}
return 0 ;
}
/**************************************************************
Problem: 1068
User: 人气呆毛选手
Language: C
Result: Accepted
Time:10 ms
Memory:1004 kb
****************************************************************/
相关文章推荐
- 九度OJ 1068:球的半径和体积 (基础题)
- 九度OJ 1068:球的半径和体积 (基础题)
- 九度oj 题目1068:球的半径和体积
- 九度OJ 1068: 球的半径和体积
- 九度OJ 题目1068:球的半径和体积
- 九度OJ 题目1068:球的半径和体积
- 九度OJ 1068 球的半径和体积 (模拟)
- 九度 OJ 1068:球的半径和体积
- 九度OJ 1068 球半径和数量 (模拟)
- 九度oj 1068
- 九度oj-1068-球的半径和体积
- 题目1066:字符串排序 题目1067:n的阶乘 题目1068:球的半径和体积
- 题目1068:球的半径和体积
- 题目1068:球的半径和体积
- 清华大学2003年机试-球的半径和体积-1068
- 题目1068:球的半径和体积
- 题目1068:球的半径和体积
- 【九度OJ1388】斐波那契数列之跳台阶
- 【九度OJ1518】|【剑指offer16】反转链表
- 九度OJ 1451-1460(10/10)