#K38757. Book Purchase Points Calculation
Book Purchase Points Calculation
Book Purchase Points Calculation
In this problem, you are given the number of books purchased, a list of their prices, a country code, and a flag indicating whether it is a special promotion day. You need to calculate the total points earned by the customer. The points are calculated as follows:
$$P=\begin{cases} S\times M & \text{if it is not a special day}\\ 2\times S\times M & \text{if it is a special day} \end{cases} $$where $$S$$ is the sum of the book prices and $$M$$ is the multiplier based on the country code. The multipliers are defined as:
- US: 1
- CA: 1.2
- UK: 1.3
- AU: 1.5
- Any other country: 1
Your task is to compute the points, cast them to an integer, and output the result. The input will be provided via standard input and the result should be printed to standard output.
inputFormat
The input is read from stdin and consists of the following:
- An integer
n
representing the number of books. - A line with
n
integers separated by spaces representing the prices of the books. - A string representing the country code.
- An integer (0 or 1) where 1 indicates it is a special promotion day, and 0 indicates it is not.
outputFormat
Output a single integer representing the total points calculated according to the formula described. The output should be printed to stdout.
## sample3
20 30 40
US
0
90