Nội dung Bài tập
- Mã:
- ThePower
- Tên:
- the power
- Dạng thi:
- oi
- Thang điểm:
- 10 điểm
- Giới hạn thời gian:
- 1 giây
- Giới hạn bộ nhớ:
- 256 MB
- Nguồn bài tập:
- Codeforces
- Link nguồn:
- http://codeforces.com/gro...
- Được tạo bởi:
- kydq
ACM ACPC CLUB has N Trainees.
Coach Hussein asked Moamen to prepare a contest to determine the level of trainees.
Moamen decide to divide the trainees into teams of each team consisting of two persons.
Each person has P power to solve the problems.
If trainee x and trainee y at the same team the total power = p(x) * p(y).
Moamen wants to calculate the total power potential of each team you can create.
Example 3 Trainees A,B,C the total power = p(A) * p(B) + p(A) * p(C) + p(B) * p(C).
can you help Moamen, please?
Input
The first line contains one integer N (2 ≤ N ≤ 105) - the number of Trainees.
The second line contains n integers p1, p2, ..., pN (1 ≤ pi ≤ 3·104) - the power of each Trainee.
Output
Print one integer - answer the problem.
Examples:
Input Output 2 3 6 18
Input Output 4 1 6 2 9 101
Theme :
Mời bạn soạn code
Ai có thể xem bài này :
Thông tin
Phần thảo luận