1 条题解
-
0
C :
#include<stdio.h> #include<stdlib.h> int main(){ double eletric,money; scanf("%lf",&eletric); if(eletric<=150) money=eletric*0.4463;//电量少于150KWh时的电费 if(eletric>150&&eletric<=400) money=150*0.4463+(eletric-150)*0.4663;//电量多于150KWh,少于400KWh时的电费 if(eletric>400) money=150*0.4463+250*0.4663+(eletric-400)*0.5663;//电量多于400KWh时的电费 printf("%.1lf",money);//保留小数点1位 printf("\n");//换行 return 0; }
Python :
n = int(input()) if n <= 150: a = n * 0.4463 print(round(a,1)) if n > 150 and n <= 400: a = 150 * 0.4463 + (n - 150) * 0.4663 print(round(a,1)) if n > 400: a = 150 * 0.4463 + 250 * 0.4663 + (n - 400) * 0.5663 print(round(a,1))
- 1
信息
- ID
- 2383
- 时间
- 1000ms
- 内存
- 32MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者