#CCBCHMUOI0000001. Mã vận chuyển và giảm giá (Shipping Code and Discount)
Mã vận chuyển và giảm giá (Shipping Code and Discount)
Shipping Code and Discount
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
A delivery service has item codes 1, 2 and 3 with unit prices 10, 20 and 30, respectively. A customer orders q items of one code. Compute unit price times q; if q >= 5, apply a 10% discount to the entire total. If the code is not 1, 2 or 3, print INVALID and do not compute a price. The result is an integer.
Input
Two integers k (item code) and q (number of items).
Output
Print the integer total for a valid code, or exactly INVALID otherwise.
Subtasks
- Subtask 1 (20%): k = 1 and 1 <= q <= 4.
- Subtask 2 (30%): 1 <= k <= 3 and 1 <= q <= 4.
- Subtask 3 (50%): -10 <= k <= 10 and 1 <= q <= 100.
Examples
Example 1
Input
2 5
Output
90
Explanation
Code 2 costs 20 each: 5 items cost 100. The 10% discount is 10, leaving 90.
Example 2
Input
1 4
Output
40
Explanation
Four type-1 items cost 40, with no discount.
Example 3
Input
7 10
Output
INVALID
Explanation
Code 7 is invalid regardless of the quantity.