_Iasw_ @ 2024-07-28 22:10:01
#include<bits/stdc++.h>
using namespace std;
int main(){
int ydl;
float money;
scanf("%d",&ydl);
if(ydl<=150){
money=ydl*0.4463;
}
if(ydl>150&&ydl<=400){
money=(ydl-150)*0.4663+66.945;
}
else{
money=(ydl-400)*0.5663+183.0537;
}
printf("%.1f",money);
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
int ydl;
float money;
scanf("%d",&ydl);
if(ydl<=150){
money=ydl*0.4463;
}
if(ydl>150&&ydl<=400){
money=(ydl-150)*0.4663+66.945;
}
if(ydl>400){
money=(ydl-400)*0.5663+183.0537;
}
printf("%.1f",money);
return 0;
}
by _Iasw_ @ 2024-07-28 22:10:40
求大佬回复
by joe_001 @ 2024-08-07 10:58:14
不用四舍五入,直接保留一位小数。
by joe_001 @ 2024-08-07 11:01:29
#include<bits/stdc++.h>
using namespace std;
double x,s;
int main()
{
cin>>x;
if(x<=150)
s=x*0.4463;
else
if(x<=400)
s=(x-150)*0.4663+66.945;
else
s=(x-400)*0.5663+183.52;
cout<<fixed<<setprecision(1)<<s;
}
by joe_001 @ 2024-08-07 11:02:23
求关!!!
▄█▀█●求求了!!!
by fcy20180201 @ 2024-08-21 21:25:54
@Iasw 似乎
money=(ydl-400)*0.5663+183.0537
这一行的 183.0537 应该改成 183.52 ?
by wanghonglei_stl @ 2024-08-24 12:44:30
试试我这个
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
double b;
cin>>a;
if(a<=150)
{
b=a*0.4463;
}
else if(a>150 && a<=400)
{
b=(a-150)*0.4663+150*0.4463;
}
else if(a>400)
{
b=(150*0.4463)+(250*0.4663)+(a-400)*0.5663;
}
printf("%.1lf",b);
return 0;
}