#C5418. Maximum Total Points
Maximum Total Points
Maximum Total Points
You are given a list of chefs. Each chef has two potential scores obtained from two different sessions: a primary session score pi and a secondary session score si. Your task is to select the maximum score from each chef's two options and compute the overall sum of these maximum scores.
In mathematical terms, if the scores for the i-th chef are \(p_i\) and \(s_i\), then the answer is \(\sum_{i=1}^{n} \max(p_i, s_i)\).
You are to implement a program that reads the number of chefs and their respective score pairs from standard input, computes the maximum total points, and prints the result to standard output.
inputFormat
The first line of input contains an integer \(n\) representing the number of chefs. The following \(n\) lines each contain two integers \(p_i\) and \(s_i\) separated by spaces, where \(p_i\) is the score from the primary session and \(s_i\) is the score from the secondary session.
Example:
4 80 90 70 85 95 65 100 60
outputFormat
Print a single integer representing the maximum total points which is the sum of the maximum scores for each chef.
Example Output:
370## sample
4
80 90
70 85
95 65
100 60
370