1 条题解

  • 0
    @ 2025-5-1 13:57:42

    lz

    #include <iostream>
    #include <iomanip>
    
    int main() {
        double x;
        std::cin >> x;
    
        double y;
        if (0 <= x && x < 5) {
            y = -x + 2.5;
        } else if (5 <= x && x < 10) {
            y = 2 - 1.5 * (x - 3) * (x - 3);
        } else if (10 <= x && x < 20) {
            y = x / 2 - 1.5;
        }
    
        std::cout << std::fixed << std::setprecision(3) << y << std::endl;
    
        return 0;
    }    
    
    • 1

    信息

    ID
    813
    时间
    1000ms
    内存
    128MiB
    难度
    10
    标签
    (无)
    递交数
    6
    已通过
    5
    上传者