#399. CSP2023PJ-16

CSP2023PJ-16

  1. (阅读程序)
#include <iostream>
#include <cmath>
using namespace std;

double f(double a, double b, double c) {
    double s = (a + b + c) / 2;
    return sqrt(s * (s - a) * (s - b) * (s - c));
}

int main() {
    cout.flags(ios::fixed);
    cout.precision(4);

    int a, b, c;
    cin >> a >> b >> c;
    cout << f(a, b, c) << endl;
    return 0;
}

假设输入的所有数都为不超过 1000 的正整数,完成下面的判断题和单选题:

(判断题)

(2分)当输入为“2 2 2”时,输出为“1.7321”。( )

{{ select(1) }}

(2分)将第 6 行中的“(s-b) * (s-c)”改为“(s-c) * (s-b)”不会影响程序运行的结果。( )

{{ select(2) }}

(2分)程序总是输出四位小数。( )

{{ select(3) }}

(选择题)

当输入为“3 4 5”时,输出为( )

{{ select(4) }}

  • “6.0000”
  • “12.0000”
  • “24.0000”
  • “30.0000”

当输入为“5 12 13”时,输出为( )

{{ select(5) }}

  • “24.0000”
  • “30.0000”
  • “60.0000”
  • “120.0000”