#B4209. Tiered Electricity Billing Calculation
Tiered Electricity Billing Calculation
Tiered Electricity Billing Calculation
Carbon neutrality requires balancing produced carbon emissions with equivalent carbon absorption. In support of this, Longcheng Electric Company has introduced a tiered electricity pricing system. The billing cycle is one year, during which the monthly electricity consumption is charged according to the following tiers:
1. For the first tier, the electricity consumption up to $$2760$$ kWh is considered as basic usage and charged at $$0.52$$ yuan per kWh.
2. The second tier covers consumption from $$2761$$ kWh to $$4800$$ kWh, charged at $$0.57$$ yuan per kWh.
3. Any consumption beyond $$4800$$ kWh falls into the third tier and is charged at $$0.82$$ yuan per kWh to encourage energy saving.
Every month, the electricity bill is calculated based on the reading difference between the end of the previous month and the current month. Given the previous meter reading u and the current meter reading v (with u ≤ v and both being non-negative integers), compute the electricity bill according to the tiered prices.
inputFormat
The input consists of two non-negative integers separated by spaces:
- u - the meter reading at the end of last month.
- v - the meter reading at the end of the current month (u ≤ v).
outputFormat
Output a single number representing the electricity bill for the current month calculated using the tiered pricing system.
sample
0 1000
520