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

基本思路:

无;

 

关键点:

无;

 

#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;
}

 

posted @ 2020-03-02 11:54  暮云林凌  阅读(170)  评论(0)    收藏  举报