From c0e29f843b36c9fe413f1b87e4ba390fc0397660 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sat, 15 Nov 2014 23:05:47 +0400 Subject: [PATCH] Project Euler problem 15 --- project_euler/p015_LatticePath.py | 41 +++++++++++++------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/project_euler/p015_LatticePath.py b/project_euler/p015_LatticePath.py index 8b15de1..fd7dc1a 100644 --- a/project_euler/p015_LatticePath.py +++ b/project_euler/p015_LatticePath.py @@ -1,26 +1,19 @@ -/* Check cf5-opt.vim defs. -VIM: let g:lcppflags="-std=c++11 -O2 -pthread" -VIM: let g:wcppflags="/O2 /EHsc /DWIN32" -*/ -#include +#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: -/* -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: -*/ - -int main ( void ) -{ - - return 0; -} +a = 1 +b = 1 +for i in range(21,41): + a *= i + b *= i-20 +print( a//b )