Score Calculation
InterviewTime limit1sMemory limit128 MB
Given 8 distinct problem scores, output the sum of the top 5 and their original indices in increasing order.
- Level
Easy2 of 10
- Topics
- Sorting, Array, Implementation
- Solved
- No attempts yet
Problem
A contestant worked on 8 problems, and the score earned for each problem is given. A problem that was not solved has a score of 0. The contestant's final score is the sum of the 5 highest scores among the 8 scores.
Given the scores for all 8 problems, compute the final score and the problem numbers that contribute to it.
Input
The input consists of 8 lines. The i-th line contains the score for problem i. Each score is an integer between 0 and 150 inclusive, and all 8 scores are distinct.
Output
Print the sum of the 5 highest scores on the first line. On the second line, print the problem numbers corresponding to those 5 scores, separated by spaces. The problem numbers must be printed in increasing order.