黄梅时节家家雨,青草池塘处处WA

P1422 小玉家的电费

WXLS194579LCX @ 2024-06-02 17:28:50

#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<=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 WXLS194579LCX @ 2024-06-02 17:30:06

?????????????????????????????????????????????????????????????????


by Disjoint_cat @ 2024-06-02 17:37:23

@WXLS194579LCX 一眼丁真,鉴定为 if(a<=400) 前没加 else


by WuJiaNuo19 @ 2024-06-02 17:42:42

@Disjoint_cat 亲测,是的


|