100 atcoder#ABC143B. [ABC143B] TAKOYAKI FESTIVAL 2019
[ABC143B] TAKOYAKI FESTIVAL 2019
Score : points
Problem Statement
It's now the season of TAKOYAKI FESTIVAL!
This year, takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The deliciousness of the -th takoyaki is .
As is commonly known, when you eat two takoyaki of deliciousness and together, you restore health points.
There are ways to choose two from the takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these values.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the sum of the health points restored from eating two takoyaki over all possible choices of two takoyaki from the takoyaki served.
3
3 1 2
11
There are three possible choices:
- Eat the first and second takoyaki. You will restore health points.
- Eat the second and third takoyaki. You will restore health points.
- Eat the first and third takoyaki. You will restore health points.
The sum of these values is .
7
5 0 7 8 3 3 2
312