Jiangxh100315 @ 2024-05-31 15:45:57
#include<bits/stdc++.h>
using namespace std;
double all,b=0.4463,c=0.4663,d=0.5663;
int main(){
cin>>all;
if(all<=150){
double n=b*all;
cout<<fixed<<setprecision(1)<<n;
}
else if(all>=151&&all<=400){
double m=c*all;
cout<<fixed<<setprecision(1)<<m;
}
else if(all>=401){
double g=d*all;
cout<<fixed<<setprecision(1)<<g;
}
return 0;
}
by forever_nope @ 2024-05-31 15:49:07
要知道,高一数学有一章专门讲这个问题的。
月用电量在
月用电量在
月用电量在
by SJY00AND11 @ 2024-12-22 11:14:53
AC代码
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
float p;
cin>>n;
if(n<=150)p=n*0.4463;
else if(n<=400)p=150*0.4463+(n-150)*0.4663;
else p=150*0.4463+250*0.4663+(n-400)*0.5663;
printf("%.1f",p);
return 0;
}