+/foobar
google programming puzzles
git clone https://git.julia.blue/+/foobar
2e1d345
master
1table = {} 2 3 4def solve (prev ,n ): 5current = prev ,n 6if current in table : 7return table [current ] 8if prev == 1 : 9table [current ]= 0 10return 0 11table [current ]= int (n < prev ) 12for i in range (min (prev - 1 ,n - 1 ),0 ,- 1 ): 13table [current ]+= solve (i ,n - i ) 14return table [current ] 15 16 17def answer (n ): 18return solve (n ,n ) 19 20 21for i in range (200 ): 22answer (i ) 23 24# f = open("grid.csv", 'w') 25# f.write('\n'.join([', '.join(map(str, row)) for row in table]))