组合题6 个小题
已作答 0 / 6
1#include <iostream>2#include <cmath>3using namespace std;4 5const double r = acos(0.5);6 7int a1, b1, c1, d1;8int a2, b2, c2, d2;9 10inline int sq(const int x) { return x * x; }11inline int cu(const int x) { return x * x * x; }12 13int main()14{15 cout.flags(ios::fixed);16 cout.precision(4);17 18 cin >> a1 >> b1 >> c1 >> d1;19 cin >> a2 >> b2 >> c2 >> d2;20 21 int t = sq(a1 - a2) + sq(b1 - b2) + sq(c1 - c2);22 23 if (t <= sq(d2 - d1)) cout << cu(min(d1, d2)) * r * 4;24 else if (t >= sq(d2 + d1)) cout << 0;25 else {26 double x = d1 - (sq(d1) - sq(d2) + t) / sqrt(t) / 2;27 double y = d2 - (sq(d2) - sq(d1) + t) / sqrt(t) / 2;28 cout << (x * x * (3 * d1 - x) + y * y * (3 * d2 - y)) * r;29 }30 cout << endl;31 return 0;32}假设输入的所有数的绝对值都不超过 1000 ,完成下面的判断题和单选题:
将第 26、27 行中的 / sqrt(t) / 2替换为/ 2 / sqrt(t),不会影响程序运行的结果。( )