#C6485. Taco's Discount Strategy
Taco's Discount Strategy
Taco's Discount Strategy
Taco Inc. offers a special discount: you can buy a pack of 5 items at a discounted price. However, the discount only makes sense if the pack price is strictly less than the sum of the prices of the five cheapest individual items from a given list.
Given a list of item prices and a discounted pack price, determine whether buying the pack saves money compared to buying the five cheapest items separately.
Mathematically, let \(S\) be the sum of the prices of the five cheapest items and \(P\) be the pack price. You need to check whether \(P < S\).
inputFormat
The input is read from standard input (stdin) and consists of three lines:
- The first line contains a single integer \(n\) (with \(n \ge 5\)), representing the number of items.
- The second line contains \(n\) space-separated integers, representing the prices of the items.
- The third line contains an integer representing the discounted pack price for 5 items.
outputFormat
The output should be printed to standard output (stdout) as a single line. Print True
if the discounted pack price is strictly less than the sum of the five cheapest items; otherwise, print False
.
8
2 3 1 5 4 6 7 8
10
True