Question about Consensual Human Cannibalism

Правка en1, от ChiefShoe, 2019-08-04 19:34:36

I am struggling with a question about Consensual Human Cannibalism:

You have n (1 <= n <= 2000) plates of humans, and each plate has a deliciousness assosiated with it: a1, a2, .., a_n, and you must count: How many quadruplets of plates (w,x,y,z) are there such that a_w+a_x+a_y+a_z = 0 (the deliciousnesses sum to 0)

I can only think of a O(n^4) slution.. any ideas?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский ChiefShoe 2019-08-04 19:34:36 416 Initial revision (published)