VM7WC '15 #3 Silver - Test Scores
View as PDFAfter landing a job in a math empire, Mr. White's first task is to grade Massey students' Putnam contests. In total, there are  
 contests that require marking, each with a certain score associated with them. Since the contest is so difficult, it is possible for students to get negative marks.
Furthermore, Mr. White can only send in up to  
 of the contests. Help Mr. White find the maximum sum of scores that he can send in.
Input Specification
The first line contains two space-separated integers  and 
.
This is followed by  lines, each containing a single integer, describing the contest scores.
Output Specification
Print a single integer, the maximum sum of up to  contest scores. The answer will be guaranteed to fit inside of a 32-bit signed integer.
Sample Input
5 2
5
2
7
5
3
Sample Output
12
Comments
do the scores have to be adjacent to each other, or just add the top
?
Just going to say, you're getting something else wrong that you would probably figure out without me mentioning it but I want to sound smart.
Anyway,
"it is possible for students to get negative marks."
so as a "so-I-don't-get-banned-again" example, if omaewamoushindeiru is really bad at computer programming and would only make his ECOO team worse if he was sent, and ECOO teams should have 4 people, and including omaewamoushindeiru there are only 4 people who want to take ECOO, then maybe it's better to kick omaewamoushindeiru out of the team.
Thank you!
he can send !!!!up-to!!!!
can Mr. White send in no scores at all?
Yes.
Another question: Is it possible to post images or gifs in comments?