提交时间:2024-01-22 17:31:21

运行 ID: 37690

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