TTC '18 Contest 1 P3 - Password

View as PDF

Submit solution

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

Author:
Problem type

jsumabat has been kidnapped! Unfortunately, he is locked inside a room which requires a secret password to open the doors. He knows that if he gathers all the numbers in the room, he will have to input the three largest numbers.

Given N integers, can you output the sum of the numbers required to exit the room?

Input Specifications

The first line will be N (3 \le N \le 1000), the amount of numbers in the room.

The next and last line will contain N spaced integers a_i (1 \le a_i \le 10^4).

Output Specifications

The only line of output should be the sum of the numbers required to escape the room.

Sample Input 1

4
2 3 5 3

Sample Output 1

11

Comments

There are no comments at the moment.