AME2014 @ 2023-12-11 21:15:18
#include<iostream>
#include <iomanip>
using namespace std;
int main(){
float n;
cin>>n;
double f;
if(n<=150)
f=n*0.4463;
if(n>=151&&n<=400)
f=0.4463*150+(n-150)*0.4663;
if(n>=401)
f=150*0,4463+250*0.4663+(n-400)*0.5663;
cout<<fixed<<setprecision(1)<<f<<endl;
system("pause");
return 0;
}
by zhouzihang1 @ 2023-12-11 21:18:48
@AME2014
f=150*0,4463+250*0.4663+(n-400)*0.5663;
这一行不对,f直接等于0了
by AME2014 @ 2023-12-11 21:40:50
@zhouzihang1 救命小数点错了,谢谢谢谢,我自己真的发现不了!