* Computer Science/Project Euler

project euler 15. problem

soicem 2016. 7. 25. 17:29

문제 : 아래와 같은 2 × 2 격자의 왼쪽 위 모서리에서 출발하여 오른쪽 아래 모서리까지 도달하는 길은 모두 6가지가 있습니다 (거슬러 가지는 않기로 합니다).

그러면 20 × 20 격자에는 모두 몇 개의 경로가 있습니까?


1
2
3
4
5
6
7
8
9
import math
 
def X_x_Y(x, y):
    print math.factorial(x+y) / (math.factorial(x) * math.factorial(y))
 
= int(raw_input("x :"))
= int(raw_input("y :"))
X_x_Y(x, y)
 
cs


cnsl@ubuntu:/tmp$ python test.py

x :20

y :20

137846528820

'* Computer Science > Project Euler' 카테고리의 다른 글

project euler 17. problem  (0) 2016.07.27
project euler 16. problem  (0) 2016.07.26
project euler 14. problem  (0) 2016.07.24
project euler 13. problem  (0) 2016.07.23
project euler 12. problem  (0) 2016.07.22