题目上的输入输出都对,但是0分
查看原帖
题目上的输入输出都对,但是0分
814481
zxhiding楼主2022/10/8 14:01
#include <stdio.h>
int main(){
    int a, b, c, d, f = 0;
    double e[3]{};
    scanf("%d %d %d %d", &a, &b, &c, &d);
    for (double x = -100; x <= 100; x++) {
        if (a * x * x * x + b * x * x + c * x + d == 0) {
            do {
                e[f] = x;
                f++;
            } while (x > 100);
        }
    }if (e[0] > e[1] && e[0] > e[2]) {
        if (e[1] > e[2]) {
            printf("% 0.2lf % 0.2lf % 0.2lf", e[2], e[1], e[0]);
        }
        else printf("% 0.2lf % 0.2lf % 0.2lf", e[1], e[2], e[0]);
    }
        if (e[0] > e[1] && e[0] > e[2]) {
            if (e[1] > e[2]) {
                printf("% 0.2lf % 0.2lf % 0.2lf", e[2], e[1], e[0]);
            }
            else printf("% 0.2lf % 0.2lf % 0.2lf", e[1], e[2], e[0]);
        }
        if (e[2] > e[1] && e[2] > e[0]) {
            if (e[1] > e[0]) {
                printf("% 0.2lf % 0.2lf % 0.2lf", e[0], e[1], e[2]);
            }
            else printf("% 0.2lf % 0.2lf % 0.2lf", e[1], e[0], e[2]);
        }return 0;
    }
2022/10/8 14:01
加载中...