1 条题解

  • 0
    @ 2025-1-20 9:04:25

    #include #include #include using namespace std; int main(){ double a , b , c , d; double e , f , g , h; double num1,num2,num3; cin >> a >> b >> c >> d; e = b * b - 3 * a * c; f = b * c - 9 * a * d; g = (2 * e * b - 3 * a * f) / (2 * sqrt(e * e * e)); h = acos(g); num1 = (-b - 2 * sqrt(e) * cos(h / 3))/(3 * a); num2 = (-b + sqrt(e) * (cos(h / 3)+sqrt(3) * sin(h/3))) / (3 * a); num3 = (-b + sqrt(e) * (cos(h/3) - sqrt(3) * sin(h/3))) / (3 * a); cout << fixed << setprecision(2) << num1 << " "; cout << fixed << setprecision(2) <<num3 << " "; cout << fixed << setprecision(2) <<num2 << " "; return 0; }

    信息

    ID
    111
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    递交数
    32
    已通过
    11
    上传者