码迷,mamicode.com
首页 > 其他好文 > 详细

清华大学机试 球的半径和体积 Easy

时间:2020-03-02 13:06:36      阅读:60      评论:0      收藏:0      [点我收藏+]

标签:清华   ret   pre   map   color   algo   class   end   using   

基本思路:

无;

 

关键点:

无;

 

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
using namespace std;

int main() {
    double x0, y0, z0;
    double x1, y1, z1;
    while (cin >> x0 >> y0 >> z0 >> x1 >> y1 >> z1){
        double pi = acos(-1);
        double r = sqrt(pow(abs(x0 - x1), 2) + pow(abs(y0 - y1), 2) + pow(abs(z0 - z1), 2));
        double v = 4 * pi * pow(r, 3)/3;
        //cout << v << endl;
        printf("%.3lf %.3lf\n", r, v);
    }
    return 0;
}

 

清华大学机试 球的半径和体积 Easy

标签:清华   ret   pre   map   color   algo   class   end   using   

原文地址:https://www.cnblogs.com/songlinxuan/p/12394748.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!