Finding the weights of a Polynomial Cellular NeurallNonlinear Network performing a given task is not straightforward. Several approaches have been proposed so far, but they are often computationally expensive. Here, we prove that quadratic programming can solve this problem efficiently and effectively in the particular case of a totalistic network. Besides the theoretical treatment, we present several examples in which our method is employed successfully for any complexity index.