Suppose we have a random variable $X$ with a pmf that puts strictly positive probability only on integer values $0,1,2,\dots,n$. The objective is to choose a $z\in\mathbb{Z}$ that minimizes
$$c\sum_{i=0}^z (z-i)^2 \Pr(X=i)+ \sum_{i=z+1}^n (z-i)^2 \Pr(X=i). $$
When $c=1$, it is obvious that $z^* = \mathbb{E}X$. However, I'm not sure how to proceed for a general $c>0$. Using calculus doesn't work well with the sums (and we really are optimizing over a discrete domain).
My thinking is to choose the maximum $z$ that satisfies $$\sum_{j=0}^{n-z-1}(1+2j)\Pr(X=z+1+j) > c\sum_{j=0}^{z}(2z+1-2j)\Pr(X=j),$$
but I'm not sure that this can be reduced to solve explicitly for $z$. Any suggestions?