АВТ
Language:

Remote Training on Programming

Problems On-line status Contests FAQ
For authors:
Register  ||  Login
 
Hello, Guest! Login or register.

840. Произведение всех пар

Time Limit: 1 seconds
Memory Limit:64000KB
Points:10
View Problem Statistics Submit Problem added Undefined

You have a sequence of N non-negative integers. N <= 100 000. You need to find sum of multiplies of all pairs numbers and output this value by modulo P = 30 000.

Input:
The first line of input contains integer N, 1 <= N <= 100 000.
The second line contains N integers, all of them satisfy following condition: 0 <= x <= 10000.

Output:
Multiply of all pairs by modulo P.

Example:
InputOutput
3
1 2 3
11
Hint: In example we have: 1 * 2 + 1 * 3 + 2 * 3 = 11.
Remember that James Gosling with us!


View Problem Statistics Submit Author/source:
Miscellaneous Problems /
6. Polynom's Roots 840. 1451. 4 - Calendar 1. A - A + B
Educational Courses / New problems in testing /
818. 999 - Cheater optimization 840. 1019. A23a - Высоты треугольника. 1021. A325 - Простые делители. 1020. A47b - Остроугольный треугольник.
We can all benefit by doing occasional "toy" programs, when artificial restrictions are set up, so that we are forced to push our abilities to the limit. The art of tackling miniproblems with all our energy will sharpen our talents for the real problems. Donald E. Knuth.
time generating 1.139 sec.
© Copyright VSTU, AVT, Nosov D.A.