Move Project Euler under puzzles.
This commit is contained in:
19
puzzles/project_euler/p015_LatticePath.py
Normal file
19
puzzles/project_euler/p015_LatticePath.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#Lattice paths
|
||||
#Problem 15
|
||||
#
|
||||
#Starting in the top left corner of a 2x2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.
|
||||
#__ _ _
|
||||
# | |_ | | |_ |__
|
||||
# | | |_ |__ |_ |
|
||||
#
|
||||
#How many such routes are there through a 20x20 grid?
|
||||
#
|
||||
#Solution:
|
||||
|
||||
a = 1
|
||||
b = 1
|
||||
for i in range(21,41):
|
||||
a *= i
|
||||
b *= i-20
|
||||
print( a//b )
|
||||
|
||||
Reference in New Issue
Block a user