tpx041 • 1年前
using namespace std; int main(){
double w,s;
cin>>w;
if(w<=10){
s=0.2+w*0.8;
cout<<fixed<<setprecision(2)<<s;
}
else if(w<=20){
s=0.2+10*0.8+(w-10)*0.75;
cout<<fixed<<setprecision(2)<<s;
}
else if(w<=30){
s=0.2+10*0.75+10*0.8+(w-20)*0.7;
cout<<fixed<<setprecision(2)<<s;
}
if(w>30){
cout<<"Fail"<<endl;
cout<<fixed<<setprecision(2)<<s;
}
return 0;}
评论: