#t15. 居民用水阶梯式水费计算程序

居民用水阶梯式水费计算程序

Tiered Water Billing

Problem Description

To encourage residents to save water, the water company uses a tiered pricing scheme. The water fee y (in yuan) a resident must pay is related to the monthly water consumption x (in tonnes) as follows:

  • when x does not exceed 15 tonnes, y = 4x/3;
  • when x exceeds 15 tonnes, y = 2.5x - 17.5.

Write a program that computes the water fee.

Input Format

The input gives a non-negative real number x on one line.

Output Format

Output the water fee to be paid, accurate to 2 decimal places.

Sample Input 1

12

Sample Output 1

16.00

Sample Input 2

16

Sample Output 2

22.50

Constraints

0 ≤ x ≤ 10000

Hint

  • Two formulas, with the boundary at 15. Watch out for integer division in 4x/3 — it depends on the type you read x with; think about what type x should be.
  • Keep 2 decimal places.
  • Check against the samples: 12 → 16.00; 16 → 22.50.