#SCKTIFELSE0000005. Tính tiền điện theo bậc (Tiered Electricity Bill)
Bài tập này chưa được xếp vào lộ trình.
Mục lục đề ⌄
Tính tiền điện theo bậc (Tiered Electricity Bill)
Tiered Electricity Bill
Version: Phuoc Hung OJ Extended
Problem Statement
A lodging house charges monthly electricity usage using three progressive tiers. The first kWh cost VND per kWh. The next kWh (from the 51st through the 100th) cost VND per kWh. Every kWh from the 101st onward costs VND. Each unit is charged at the rate of its own tier, rather than charging all units at the highest rate. Every customer also pays a fixed service fee of VND. Type H customers receive no discount. Type S customers receive a discount on the tiered electricity charge, but not on the service fee. Given the monthly kWh usage and customer category, calculate the final amount due.
Input
One line contains the integer , the number of kWh used, and the character (H or S), the customer category, separated by one space.
Output
Print a single integer: the total amount due in Vietnamese dong, with no currency symbol or thousands separators.
Subtasks
-
Subtask 1 (20 points): ;
-
Subtask 2 (30 points): ;
-
Subtask 3 (50 points): ;
Examples
Example 1
Input
0 S
Output
15000
Explanation
Usage of kWh incurs no electricity charge; the discount remains zero, and the VND service fee is added.
Example 2
Input
75 H
Output
160000
Explanation
Tier 1 costs VND and tier 2 costs VND. The electricity charge is VND. Type H gets no discount, so the total is VND.
Example 3
Input
120 S
Output
245400
Explanation
Tier 1 costs VND, tier 2 costs VND, and tier 3 costs VND. Electricity is VND, discounted by to VND. Adding VND gives VND.