hxyscjdmb @ 2024-12-24 22:11:19
using namespace std;
int main(){ float x,a,b,c; cin>>x; a=-x+2.5; b=2-1.5(x-3)(x-3); c=x/2-1.5; if(x>0&&x<5){ cout<<fixe
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
float x,a,b,c;
cin>>x;
a=-x+2.5;
b=2-1.5*(x-3)*(x-3);
c=x/2-1.5;
if(x>0&&x<5){
cout<<fixed<<setprecision(3)<<a<<endl;
}else if(x>=5&&x<10){
cout<<fixed<<setprecision(3)<<b<<endl;
}else if(x>=10&&x<20){
cout<<fixed<<setprecision(3)<<c<<endl;
}
return 0;
}
d<<setprecision(3)<<a<<endl; }else if(x>=5&&x<10){ cout<<fixed<<setprecision(3)<<b<<endl; }else if(x>=10&&x<20){ cout<<fixed<<setprecision(3)<<c<<endl; } return 0; }
by dqh_0616 @ 2024-12-24 22:16:53
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
float x,a,b,c;
cin>>x;
a=-x+2.5;
b=2-1.5*(x-3)*(x-3);
c=x/2-1.5;
if(x>=0&&x<5){
// ^^
cout<<fixed<<setprecision(3)<<a<<endl;
}else if(x>=5&&x<10){
cout<<fixed<<setprecision(3)<<b<<endl;
}else if(x>=10&&x<20){
cout<<fixed<<setprecision(3)<<c<<endl;
}
return 0;
}
by dqh_0616 @ 2024-12-24 22:18:04
@hxyscjdmb