This commit is contained in:
parent
1f967bfd6f
commit
97f112131d
@ -22,15 +22,20 @@ def s(n,k):
|
|||||||
|
|
||||||
def S(n, k):
|
def S(n, k):
|
||||||
if n == k:
|
if n == k:
|
||||||
return 1
|
return " S_{" + n + "," + k + "} "
|
||||||
|
# return 1
|
||||||
elif k == 1:
|
elif k == 1:
|
||||||
return 1
|
return " S_{" + n + "," + k + "} "
|
||||||
|
# return 1
|
||||||
elif k == 0:
|
elif k == 0:
|
||||||
return 0
|
return " S_{" + n + "," + k + "} "
|
||||||
|
# return 0
|
||||||
elif n < k:
|
elif n < k:
|
||||||
return 0
|
return " S_{" + n + "," + k + "} "
|
||||||
|
# return 0
|
||||||
else:
|
else:
|
||||||
return S(n-1,k-1) + k * S(n-1,k)
|
return " S_{" + str(n-1) + "," + str(k-1) + "} + " + str(k) + " * S_{" + str(n-1) + "," + str(k) + "} "
|
||||||
|
# return S(n-1,k-1) + k * S(n-1,k)
|
||||||
|
|
||||||
# print(S(9,5))
|
print(S(5,3))
|
||||||
print(p(10,4))
|
# print(p(10,4))
|
||||||
|
Loading…
Reference in New Issue
Block a user