简单数学模拟题。我们显然知道球体的体积公式其中为半径;又知道空间直角坐标系两点的距离公式于是轻而易举地解决本题。

#include <bits/stdc++.h>
#include <iomanip>
#define _CRT_SECURE_NO_DEPRECATE

std::pair<double, double> sphereParamCalculator(int centerX, int centerY,
        int centerZ, int surfaceX, int surfaceY, int surfaceZ) {
    double radius = std::sqrt((centerX - surfaceX) * (centerX - surfaceX) +
                              (centerY - surfaceY) * (centerY - surfaceY) + (centerZ - surfaceZ) *
                              (centerZ - surfaceZ));
    double volume = std::acos(-1) * radius * radius * radius * 4 / 3;
    std::pair ans = std::make_pair(radius, volume);
    return ans;
}

int main() {
    int x0, y0, z0, x1, y1, z1;
    while (std::cin >> x0 >> y0 >> z0 >> x1 >> y1 >> z1) {
        std::pair result = sphereParamCalculator(x0, y0, z0, x1, y1, z1);
        std::cout << std::fixed << std::setprecision(3) << result.first << " " <<
                  std::fixed << std::setprecision(3) << result.second << std::endl;
    }
    return 0;
}

因为是上机题所以没有直接在main里计算而是开了一个可以返回(Pair)的函数。实际这一部分内容直接计算也没有什么问题。