#include<stdio.h>
int main(void){
int power;
double cost;
scanf("%d",&power);
if(power>=0&&power<=50){
cost = 0.53 * power;
printf("cost = %.2f",cost);
}
else if(power>50){
cost = 50 * 0.53 + (power-50)*0.58;
printf("cost = %.2f",cost);}
else
printf("Invalid Value!");
return 0;
}
习题2-2 阶梯电价
最新推荐文章于 2024-11-03 00:42:08 发布