qinyaoxin520 @ 2023-11-23 21:14:24
#include<bits/stdc++.h>
using namespace std;
int main(){
double a,b;
cin>>a;
if(a>0&&a<5)
{
b=-a+2.5;
}
if(a>5&&a<10)
{
b=2-1.5*(a-3)*(a-3);
}
if(a<20&&a>10)
{
b=a/2-1.5;
}
cout<<fixed<<setprecision(3)<<b;
return 0;
}
帮忙看一下这个哪里错了 感谢!!!
by wwqwq @ 2023-11-23 21:18:19
#include<bits/stdc++.h>
using namespace std;
int main(){
double a,b;
cin>>a;
if(a>=0&&a<5)
{
b=-a+2.5;
}
if(a>=5&&a<10)
{
b=2-1.5*(a-3)*(a-3);
}
if(a<20&&a>=10)
{
b=a/2-1.5;
}
cout<<fixed<<setprecision(3)<<b;
return 0;
}
by wwqwq @ 2023-11-23 21:18:37
@qinyaoxin520
by wwqwq @ 2023-11-23 21:19:02
分段那里有的没写=
by qinyaoxin520 @ 2023-11-23 21:51:33
@wuweiqi 谢谢大佬!!!我悟了QAQ