Run ID:2123
提交时间:2023-12-16 12:04:27
#include<iostream> #include<iomanip> using namespace std; int main() { double x,a=0; cin>>x; if(x>=0&&x<=20) { if(x<5) a=(-x+2.5); else if(x>=5&&x<10) a=(2-1.5*((x-3)*2)); else a=(x/2-1.5); cout<<fixed<<setprecision(3)<<a; } return 0; }