______          __          ______          
  / ____/___  ____/ /__  _____/ ____/_  ______ 
 / /   / __ \/ __  / _ \/ ___/ /   / / / / __ \
/ /___/ /_/ / /_/ /  __/ /  / /___/ /_/ / /_/ /
\____/\____/\__,_/\___/_/   \____/\__,_/ .___/ 
                                      /_/ 
        

$1,500 in prize money and unique problems. Register for the TrialSpark x Coder Cup competition by Feburary 22 before space runs out. Also, TrialSpark is hiring engineers.

Criss Cross

The most creative correct solution wins $100. Submissions for prize money are now closed.

A 4x4 grid is filled with digits d, 0 ≤ d ≤ 9.

It can be seen that in the grid

6 3 3 0
5 0 4 3
0 7 1 4
1 2 4 5

the sum of each row and each column has the value 12. Moreover the sum of each diagonal is also 12.

In how many ways can you fill a 4x4 grid with the digits d, 0 ≤ d ≤ 9 so that each row, each column, and both diagonals have the same sum?

https://projecteuler.net/problem=166