attempt06 @ 2024-11-10 17:56:47
#include<stdio.h>
main()
{
int x;
float y;
scanf("%d",&x);
if(x<=150)
y=x* 0.4463;
else if(x>150&&x<=400)
y=(x-150) *0.4663+150*0.4463;
else
y=(x-400) *0.5663+(400-151)*0.4663+150*0.4663;
printf("%.1f",y);
}
by wzy20110830 @ 2024-11-10 19:03:01
#include <stdio.h>
int main() {
double x, y;
scanf("%lf", &x);
if (x <= 150)
y = x * 0.4463;
else if (x > 150 && x <= 400)
y = (x - 150) * 0.4663 + 66.945;
else
y = (x - 400) * 0.5663 + 183.52;
printf("%.1f", y);
}
else if
和 else
里那些常数项自己算出来再加上去(比如 double
,精度高一些,用法如 double a;scanf("%lf", &a);
by wzy20110830 @ 2024-11-10 19:03:55
求关