d

P1422 小玉家的电费

Minecraft100 @ 2024-07-20 12:59:42

20分求大佬帮助


by cyx20131003 @ 2024-07-26 08:43:26

参考一下!

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    double s=0.0;
    cin>>n;
    if(n<151) s=n*0.4463;
    else if(n<401) s=150*0.4463+(n-150)*0.4663;
    else s=150*0.4463+250*0.4663+(n-400)*0.5663;
    printf("%.1lf",s);
    return 0;
} 
//㊣

|