1,2,3WA 求助

P1422 小玉家的电费

```cpp #include<stdio.h> int main(){ double x,f; scanf("%lf",&x); if(x<=150){ f=x*0.4463; } if(x>=151&&x<=400){ f=150*0.4463+(x-150)*0.4663; } if(x>400) { f=150*0.4463+250*0.4663+(x-400)*0.5663; } printf("%.1lf",f+0.05); return 0; } `````` 把else去掉应该就好了
by huta0 @ 2023-11-18 12:44:48


@[huta0](/user/749665) 还是不行
by WOLLOW_ @ 2023-11-24 18:26:38


```cpp #include<stdio.h> int main(){ double x,f; scanf("%lf",&x); if(x<=150){ f=x*0.4463; } else if(x>=151&&x<=400){ f=150*0.4463+(x-150)*0.4663; } else if(x>400) { f=150*0.4463+250*0.4663+(x-400)*0.5663; } printf("%.1lf",f+0.05); return 0; } ``` 试试吧
by Ysfu @ 2023-11-28 18:30:39


|