60分 求大佬救救

P1422 小玉家的电费

oooookucha @ 2024-10-04 15:01:37

#include <stdio.h>
int main()
{
int n;double price;
scanf("%d",&n);
if(n<=150){
    price=n*0.4463;
}
else if(n>=151&&n<=400)
{
    price=150*0.4463+(n-150)*0.4663;
}
else{
    price=150*0.4463+150*0.4663+(n-150-400)*0.5663;
}
printf("%.1lf",price);
return 0;
}

by Hagasei @ 2024-10-04 15:05:23

@oooookucha 第三部分改为 price=150*0.4463+250*0.4663+(n-400)*0.5663;


by oooookucha @ 2024-10-04 15:12:11

@Hagasei !!谢谢你同志


|