#P6067. [USACO05JAN] Moo Volume S
[USACO05JAN] Moo Volume S
Description
There are cows on Farmer John’s farm (). The position of the -th cow is ().
The cows are very talkative. Each cow chats with the other cows. When the -th cow chats with the -th cow, the volume is .
Please compute the sum of the volumes of all cow conversations.
Input Format
The first line contains an integer .
The next lines each contain an integer .
Output Format
Output the total volume.
It is guaranteed that the answer fits in the range of a 64-bit signed integer.
5
1
5
3
2
4
40
Hint
- Subtask 1 (original testdata, 1 point): .
- Subtask 2 (99 points): no special constraints.
Translated by ChatGPT 5
京公网安备 11011102002149号