diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2014-08-31 20:21:45 +0200 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2014-08-31 20:35:09 +0200 |
| commit | 95341b61b030c9e1290f3b326cb7ec584f543aea (patch) | |
| tree | 852386fa04d32eb859bca11c0eff7b5ef9e50f00 /015.py | |
| parent | 571164d977f91925c4c76a292f74f5f93d09ae23 (diff) | |
Diffstat (limited to '015.py')
| -rw-r--r-- | 015.py | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -0,0 +1,29 @@ + +size = 20 + +field = [ [ 1 for i in range(0, size+1) ] for i in range(0, size+1) ] + +for i in xrange(1, size+1): + for j in xrange(1, size+1): + field[i][j] = field[i][j-1] + field[i-1][j] + +print field[size][size] + + +# +# recursive solution. too slow +# +#def count_path(width, height): +# if width == 0 and height == 0: +# return 1 +# +# count = 0 +# if width > 0: # go right +# count += count_path(width-1, height) +# if height > 0: # go down +# count += count_path(width, height-1) +# +# return count +# +#print count_path(20, 20) + |
