20分求大佬帮助!!

P1422 小玉家的电费

Minecraft100 @ 2024-07-20 13:00:52

oooo


by Vincent615 @ 2024-07-20 13:02:46

@Minecraft100

代码发出来


by shimucheng @ 2024-07-20 13:05:29

@Minecraft100 代码呢??没有代码怎么改?


by danlao @ 2024-07-20 13:05:53

@Minecraft100 等我长大了,我要买一台能看到别人电脑里文件的电脑


by wangif424 @ 2024-07-20 13:51:02

@Minecraft100 你第二个if前面没加else


by Vincent615 @ 2024-07-20 14:17:09

@wangif424

if前加else?


by wangif424 @ 2024-07-20 14:33:06

@Vincent615

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a;
    double b=0;
    cin>>a;
    if(a<=150){
        b=a*0.4463;
    }
    if(a>150&&a<=400){
        a=a-150;
        b=150*0.4463+a*0.4663;
    }
    else{
        a=a-400;
        b=150*0.4463+250*0.4663+a*0.5663;
    }
    cout<<fixed<<setprecision(1)<<b;
    return 0;
 } 

这是他的代码


by Vincent615 @ 2024-07-20 20:21:55

@wangif424

哦,谢谢 ,ok


|