Someone help me with this problem please!

Правка en1, от adsijf, 2021-05-16 07:02:58

Given an array a consisting of n elements, call array b consisting of n elements such that (a[1] — b[1])^2 + (a[2] — b[2])^2 + ... + (a[n] — b[n])^2 is minimum and sum of all elements of array B is equal to m.

Given n, array A, m, find the value of (a[1] — b[1])^2 + (a[2] — b[2])^2 + ... + (a[n] — b[n])^2.

Input : first line n,m respectively, second line is the elements of array A Output : the expected value

Ex: Input : 3 3 3 4 5 Output : 27

Input : 2 3 4 5
Output : 4

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский adsijf 2021-05-17 16:50:38 65
en2 Английский adsijf 2021-05-16 07:05:01 24 Tiny change: ' Input : 2 3 4 5\n' -> ' Input : 10 4\n 2 3 4 5\n'
en1 Английский adsijf 2021-05-16 07:02:58 623 Initial revision (published)