Write $n^2$ real numbers into $n \times n$ square grid Let $k$ and $n$ be two positive integers such that $k<n$ and $k$ does not divide $n$. Show that one can fill a $n \times n$ square grid with $n^2$ real numbers such that sum of numbers in an arbitrary $k \times k$ square grid is negative, but sum of all $n^2$ numbers is positive.
Source: Homework
My idea: I presented $n = mk + r$ and write $-k^2$ into each square with coordinate of the form $(ik, jk)$ where $i, j$ are positive integers and 1 in another squares. Then the sum of each $k \times k$ square is $-1$ and sum of $n^2$ numbers is $n^2 - m^2(k^2+1)$. But this doesn't work for large $m$.

This is a slight variant on the construction in Marcus M's answer.
Having written $n=mk+r$ with positive integers $m$ and $0\lt r\lt k$, start with a matrix of the form
$$\pmatrix{
a&-1&\ldots&-1&\ldots&a&-1&\ldots&-1&b&\ldots&b\\
a&-1&\ldots&-1&\ldots&a&-1&\ldots&-1&b&\ldots&b\\
\vdots\\
a&-1&\ldots&-1&\ldots&a&-1&\ldots&-1&b&\ldots&b\\
}$$
where each row consists of an $a$ followed by $(k-1)$ $-1$'s, repeated $m$ times, with $r$ $b$'s at the end.  Note that the sum of any $k$ consecutive numbers in any row is either $a-(k-1)$ or $bs-(k-s)$ with $1\le s\le r$, while the sum of the entire row is $m(a-(k-1))+br$.  
Next, let $a=k-1$ and $b={k\over r}-1$.  The assumption $0\lt r\lt k$ implies $a$ and $b$ are both positive.  Our construction so far implies that the sum of any $k$ consecutive numbers in any row is either 
$$a-(k-1)=(k-1)-(k-1)=0$$ 
or 
$$bs-(k-s)=({k\over r}-1)s-(k-s)={s\over r}k-k\le0$$
while the sum of all the numbers in a row is
$$m(a-(k-1))+br=m((k-1)-(k-1))+({k\over r}-1)r=k-r\ge1$$
Thus the sum of the numbers in any $k\times k$ block is less than or equal to $0$, while the sum of the entire $n\times n$ matrix is greater than or equal to $n$.  
Now this isn't quite what's required, but it's easy to fix it:  Just subtract a very small number (anything less than $1/n$ will do) from every number in the matrix, including all the $-1$'s.  Doing so ensures that every $k\times k$ block now has a negative sum while the sum for the entire matrix is still positive.
