zhan0518 @ 2024-03-02 08:01:05
#include<bits/stdc++.h>
using namespace std;
int main()
{
int d;
cin >> d;
double cnt = 0;
int c = d;
if(d <= 150)
{
cout << setprecision(1) << d * 0.4463 << fixed;
return 0;
}
else if(d >=151 && d <= 400)
{
c -= 150;
cout << setprecision(1) << fixed << c * 0.4663 + 150 * 0.4463;
return 0;
}
else
{
d -= 400;
cout << setprecision(1) << fixed << d * 0.5663 + 150 * 0.4463 + 250 * 0.5663;
return 0;
}
}
by hepp @ 2024-03-02 08:11:44
@zhan0518 else里面250乘的不是0.5663
by _th_tw_on_ @ 2024-03-02 08:12:55
#include<bits/stdc++.h>
using namespace std;
int main()
{
double d;
cin >> d;
double c = d;
if(d <= 150)
{
cout << setprecision(1) << fixed << d * 0.4463;
}
else if(d >=151 && d <= 400)
{
c -= 150;
cout << setprecision(1) << fixed << c * 0.4663 + 150 * 0.4463;
}
else
{
d -= 400;
cout << setprecision(1) << fixed << d * 0.5663 + 150 * 0.4463 + 250 * 0.4663;
}
}