60marks,help

P1422 小玉家的电费

LIUYINQIAO @ 2024-07-13 17:59:22

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

by ljt114514 @ 2024-07-15 12:34:37

#include<bits/stdc++.h>
using namespace std;
int main(){
    long long w;
    cin>>w;
    if(w<=150)printf("%.1lf",w*0.4463);
    if(w>150&&w<=400)printf("%.1lf",66.945+(w-150)*0.4663);
    if(w>400)printf("%.1lf",116.575+66.945+(w-400)*0.5663);
    return 0;
} 

by LIUYINQIAO @ 2024-07-15 15:39:17

@ljt114514 AC,i had already subscribed to you


by yinzexuan @ 2024-07-29 10:00:37

Are you Chinese?


|