Best strategy for minimizing cost of coin-flipping game The Problem
You are required to flip your own coin $n$ times, and count $h$ the number of times it comes up heads, with a target head count of $t$, where $t$ is an integer $ \le \frac{n}{2}$.  If $h$ undershoots the target number, then you are penalized $t - h$ points.  If you overshoot, you are penalized $k(h - t)$ points where $k$ is a real $ \ge 1$.  You get to choose the exact probability your coin comes up heads, $p$.  What is the optimal $p$ to choose to minimize your expected cost for a given $n$, $t$, and $k$?  
What I've figured out
When $k=1$ the obvious strategy is to choose $p = \frac{t}{n}$.  When $t$ is very small and $k$ is very large, I think the best strategy might be to choose $p=0$ and accept the fixed cost of $t$.  
Generally, though, there will be some $p = \frac{t}{n} - \epsilon$ that minimizes expected cost.  
The probability of flipping $i$ heads is $\dfrac{\binom{n}{i}}{2^n}p^i(1-p)^{n-i}$, so the exact expected cost of any $p$ can be calculated as
$$\sum_{i=0}^{t-1} \left((t-i)\dfrac{\binom{n}{i}}{2^n}p^i(1-p)^{n-i}\right)
+ k\sum_{i=t+1}^{n} \left((i-t)\frac{\binom{n}{i}}{2^n}p^i(1-p)^{n-i}\right)$$
which is impractical to calculate for large n and doesn't give me a reasonable intuition for a closed form answer for $p$.  
My intuition is that you just need to choose p so that $k$(probability of undershoot)(expected magnitude of undershoot) = (probability of overshoot)(expected magnitude of overshoot), but I don't have the chops to prove that.
 A: I'm not quite there yet.
The answer can be approximated by replacing the discrete binomial distribution with a continuous normal one.  
A binomial distribution with $n$ trials and probability $p$ has mean $np$ and variance $np(1-p)$. This means that the corresponding normal probability density function is
$$\mathrm{pdf}(x) = \dfrac{1}{\sqrt{2np(1-p)\pi}}e^{-\dfrac{(x-np)^2}{2np(1-p)}}$$
The probability of undershooting is:
$$\mathrm{Pr}(h < t) = P_u \approx \int_{-\infty}^{t}\mathrm{pdf}(x)\ dx = \frac12 \left[1 + \mathrm{erf}\left(\frac{t-np}{\sqrt{2np(1-p)}}\right)\right]$$
and the mean of the undershoot case is:
$$\mu_u \approx \frac{\int_{-\infty}^{t} x\ \mathrm{pdf}(x)\ dx}{P_u}$$
The probability of overshooting is $\mathrm{Pr}(h > t) = P_o = 1 - P_u$, and since we know the mean of the distribution is $np$, we can find the mean of the overshoot case $\mu_o$.
$$
\mu_u P_u + \mu_o P_o = np\\
\mu_o = \frac{np - \mu_u P_u}{P_o}
$$
But I still can't quite calculate that integral in the definition for $\mu_u$.
