VMSS Pre-Pre-Windsor P7 - Magical Bribery

View as PDF

Submit solution


Points: 7
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem type

Anish has been having trouble in computer science, and is trying to bribe Mr. McKenzie to raise his mark. Now, since bribing Mr. McKenzie with money obviously won't work, Anish is going to use magic cards. Mr. McKenzie places value on a certain amount of magic cards, for example 3 cards might have a value of 5, then 4 cards have a value of 6, and 6 cards could have a value of 12. Given how many cards Anish has, and how much Mr. McKenzie values every amount of cards, print out the maximum value Anish can get for his cards.

Input Specification

A number N (1 \le N \le 1000) for how many cards Anish has, and on the next N lines, a number N_i (N_i \ge 1) which represents how much Mr. McKenzie values a package of i cards.

Output Specification

The maximum value Anish can get for his cards.

Sample Input

8
6
15
18
22
25
51
51
59

Sample Output

66

Comments


  • 0
    maxcruickshanks  commented on Nov. 11, 2022, 4:39 p.m.

    Since the original data were wrong, they were updated, and all submissions were rejudged.


  • 0
    frankvp11  commented on Nov. 11, 2022, 2:29 p.m.

    Are we allowed to re-use the cards? Or is it a one time thing?


  • 0
    injust  commented on Dec. 25, 2018, 3:48 a.m.

    There seems to be 3 trailing numbers in the input data for test case #5.