60分求指点 !!!(可以给关注 )

P1422 小玉家的电费

liuzicheng100 @ 2024-10-31 11:54:13

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

by xywuyu @ 2024-10-31 12:16:57

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

by xywuyu @ 2024-10-31 12:21:00

@liuzicheng100


by nieqiuran @ 2024-10-31 12:30:11

@liuzicheng100

#include<bits/stdc++.h>
using namespace std;
double n,sum;
int f;
int main(){
    cin>>n;
    if(n<=150) sum = n*0.4463;
    if(n>=151&&n<=400) sum = 66.945+(n-150)*0.4663;
    if(n>=401) sum = 183.52+(n-400)*0.5663; 
    cout<<fixed<<setprecision(1)<<sum<<endl;
    return 0;
}

by zxw1234567 @ 2024-10-31 12:36:41

@liuzicheng100


if s > 400:
    print('%.1f' % ((s - 400) * 0.5663 + 250 * 0.4663 + 150 * 0.4463))
elif s > 150:
    print('%.1f' % ((s - 150) * 0.4663 + 150 * 0.4463))
else:
    print('%.1f' % (s * 0.4463))

by zxw1234567 @ 2024-10-31 12:39:31

@liuzicheng100


s = int(input())
if s > 400:
    print('%.1f' % ((s - 400) * 0.5663 + 250 * 0.4663 + 150 * 0.4463))
elif s > 150:
    print('%.1f' % ((s - 150) * 0.4663 + 150 * 0.4463))
else:
    print('%.1f' % (s * 0.4463))

by liuzicheng100 @ 2024-10-31 14:28:12

谢谢大佬,全部都关注完了


|