#P1422. 小玉家的电费
小玉家的电费
Xiaoyu's Electricity Bill
Problem Source
Luogu P1422
Problem Description
Summer is here, and every household is using far more electricity — and paying far more for it. Xiaoyu's family received an electricity bill today. It reads: according to the regulation Min Dian Jia [2006] No. 27, the tiered pricing is as follows:
- For the portion of monthly usage up to and including kWh: yuan per kWh;
- For the portion between and kWh: yuan per kWh;
- For the portion of kWh and above: yuan per kWh.
Xiaoyu wants to check whether the billed amount is correct. Write a program that, given the total electricity used, computes the bill according to these rates.
Input Format
The input is a single positive integer: the total electricity used (in kWh), not exceeding .
Output Format
Output one number, kept to 1 decimal place (in yuan, kept to 1 decimal place).
Sample Input
267
Sample Output
121.5
Hint
- The three tiers are additively accumulated: each tier only charges for the part of the usage that falls within that tier's band — you do not compute the whole usage at a single tier's rate.
- First break the sample down on paper (how does 267 kWh split into two bands?) before writing code.
- Keep 1 decimal place.