-->
当前位置:首页 > 题库

PROGRAMMING:Step tariff

Luz5年前 (2021-05-10)题库401
In order to promote the residents to save electricity, a provincial power company implements the "ladder price". The electricity price of the residents who install one meter for one household is divided into two "ladder": if the monthly electricity consumption is less than 50 kWh (including 50 KWH), the electricity price is 0.53 yuan / kWh; If the electricity consumption exceeds 50 kwh, the electricity price will be increased by X Yuan / kWh. Please write a program to calculate the electricity charge.
###Input format:
Enter the monthly electricity consumption of a user (unit: KWH) and the 'x' value of the price increase (unit: yuan) in one line, separated by a space.
###Output format:
Output the electricity charge (yuan) that should be paid by the user in one line, and keep two decimal places in the result. The format is as follows: "cost = value of electricity charge payable".
###Input sample 1:
Here is a set of inputs. For example:
```in
10 0.05
```
###Output sample 1:
The corresponding output is given here. For example:
```out
cost = 5.30
```
###Input example:
Here is a set of inputs. For example:
```in
100 0.05
```
###Output example:
The corresponding output is given here. For example:
```out
cost = 55.50
```







answer:If there is no answer, please comment
```
m,n=input().split()
m=float(m)
n=float(n)
if m>50:
print("cost = {:.2f}".format(50*0.53+(m-50)*(0.53+n)))
else:
print("cost = {:.2f}".format(m*0.53))
```