#B3763. Effective Score Calculation in Ladder Contest
Effective Score Calculation in Ladder Contest
Effective Score Calculation in Ladder Contest
In the ladder contest, there are three tiers of problems: Base, Intermediate, and Top.
The contest rules are as follows:
- The Base level consists of 8 problems. The total possible score is 100 points (with two problems each worth 5, 10, 15, and 20 points respectively, and one additional problem to make 100 points overall).
- The Intermediate level consists of 4 problems, each worth 25 points, for a total of 100 points.
- The Top level consists of 3 problems, each worth 30 points, for a total of 90 points.
The contestant's raw scores are given for all 15 problems in the order: Base (8), Intermediate (4), and Top (3). However, not all scores count towards the final effective score. The rules for scoring are as follows:
- The Base level scores always count.
- The Intermediate level scores count only if the total Base score is greater than or equal to \(80\) (i.e. \(\ge 80\)).
- The Top level scores count only if the Intermediate level's raw score is greater than or equal to \(40\) (provided that the Base level condition is met).
Your task is to compute the final effective score of a contestant given the scores of all 15 problems. The effective score is computed as:
[ \text{Effective Score} = \text{Base Sum} + \Bigl(\text{Intermediate Sum} \times \mathbf{1}{{\text{Base Sum}\ge80}}\Bigr) + \Bigl(\text{Top Sum} \times \mathbf{1}{{\text{Base Sum}\ge80 \text{ and } \text{Intermediate Sum}\ge40}}\Bigr) ]
Note: The term "greater than or equal to" means that the thresholds include the equal value.
inputFormat
The input consists of a single line containing 15 space-separated integers. The first 8 integers represent the Base level scores, the next 4 integers represent the Intermediate level scores, and the last 3 integers represent the Top level scores.
outputFormat
Output a single integer representing the effective score of the contestant based on the rules described above.
sample
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
150