52,求救!!!!!

B2047 分段函数

shizichen1206 @ 2025-01-05 13:32:58


#include<bits/stdc++.h>
using namespace std;
double x;
int main(){
    cin>>x;
    if (0<x&&x<5) {
        cout<<fixed<<setprecision(3)<<-x+2.5;
    }
    else if (5<x&&x<10) {
        cout<<fixed<<setprecision(3)<<2-1.5*(x-3)*(x-3);
    }
    else if (10<x&&x<20) {
        cout<<fixed<<setprecision(3)<<x/2-1.5;
    }
    return 0;
}

by S14819 @ 2025-01-05 13:35:28

小于等于!!!


by tangweiren @ 2025-01-05 13:50:50

小于等于


|