| ICPC Asia Bangkok Regional Contest 2025 |
|---|
| Закончено |
At a grand and dazzling dance party, there are $$$N$$$ guests, each with their own dance skill power $$$a_i$$$.
When two guests pair up on the dance floor, their performance score is equal to the square root of the sum of their skill powers. For example, if one guest has a skill power of $$$4$$$ and another has $$$5$$$, their duet would have a performance score of $$$\sqrt{4 + 5} = 3$$$.
As the host of this vivid celebration, you wish to measure the collective joy — the total performance score of every possible pair of guests dancing together exactly once.
Your task is to determine this total score.
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 200000$$$) — the number of guests.
The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1\le a_i \le 10^9$$$) — the dancing skill powers of the guests.
A single real number — the total performance score at the party.
The answer is considered correct if the relative error does not exceed $$$10^{-6}$$$.
57 3 11 2 17
39.009712
All possible pairs and their performance scores are:
Guest $$$1$$$ and guest $$$2$$$: $$$\sqrt{7+3} \approx 3.162277660$$$
Guest $$$1$$$ and guest $$$3$$$: $$$\sqrt{7+11} \approx 4.242640687$$$
Guest $$$1$$$ and guest $$$4$$$: $$$\sqrt{7+2} = 3$$$
Guest $$$1$$$ and guest $$$5$$$: $$$\sqrt{7+17} \approx 4.898979486$$$
Guest $$$2$$$ and guest $$$3$$$: $$$\sqrt{3+11} \approx 3.741657387$$$
Guest $$$2$$$ and guest $$$4$$$: $$$\sqrt{3+2} \approx 2.236067977$$$
Guest $$$2$$$ and guest $$$5$$$: $$$\sqrt{3+17} \approx 4.472135955$$$
Guest $$$3$$$ and guest $$$4$$$: $$$\sqrt{11+2} \approx 3.605551275$$$
Guest $$$3$$$ and guest $$$5$$$: $$$\sqrt{11+17} \approx 5.291502622$$$
Guest $$$4$$$ and guest $$$5$$$: $$$\sqrt{2+17} \approx 4.358898944$$$
Adding them all up gives approximately $$$39.009712$$$.
| Название |
|---|


