1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/// LEGEN - wait for it - DARY!
/// Idę po maxa... xdd
#include <cstdio>
#include <algorithm>
using namespace std;

int T[2000 * 2000];

int main ()
{
    int n, m, i, sum = 0;
	scanf ("%d", &n);
	m = n * (n + 1) / 2;
	for (i = 0; i < m; i++)
        scanf ("%d", &T[i]);

    sort (T, T + m);

    for (i = 0; i < n; i++)
        sum += T[i];

    printf ("%d", sum);
}