lwj200623 @ 2024-09-02 13:16:47
#include<bits/stdc++.h>
using namespace std;
int main()
{
int w;
double a;
cin >> w;
cout << fixed << setprecision(1);
if (w <= 150)
{
a = w * 0.4463;
}
else if (150 < w <= 400)
{
a = (150 * 0.4463 + (w - 150) * 0.4663);
}
else if (w>400)
{
a = 150 * 0.4463 + 250 * 0.4663 + (w - 400) * 0.5663;
}
a = int((a * 10) + 0.5) / 10.0;
cout << a;
}
by hanxiaofensheng @ 2024-09-05 10:00:05
@fifast 你不会不懂吧?学过自定义函数的人应该都会这样做的
by fifast @ 2024-09-05 21:19:19
@hanxiaofensheng 我写成局部变量会出错????
by hanxiaofensheng @ 2024-09-05 21:29:11
@fifast 不会