Solution:
Simple Problem.
When $k=3$.
If n is a odd number, then the answer is: $a_0=1$, $a_1=\frac{n-1}{2}$, $a_2=\frac{n-1}{2}$.
If $n\ mod\ 4 = 0$, then $a_0=\frac{n}{2}$, $a_1=\frac{n}{4}$, $a_2=\frac{n}{4}$.
Otherwise, n is normal even number, then $a_0=2$, $a_1=\frac{n-2}{2}$, $a_2=\frac{n-2}{2}$.
When $k>3$, we just fill up the array with 1 until last 3 elements.