提交时间:2023-12-02 12:35:00

运行 ID: 32674

#include <iostream> #include <iomanip> using namespace std; int main() { double x,y; cin>>x; 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; } cout<<fixed<<setprecision(3)<<y; return 0; }