조합
This commit is contained in:
13
zeta_python/completed/11050.py
Normal file
13
zeta_python/completed/11050.py
Normal file
@@ -0,0 +1,13 @@
|
||||
N, K = map(int, input().split())
|
||||
|
||||
|
||||
def C(n, k):
|
||||
if n == 1:
|
||||
return 1
|
||||
elif k == 0 or k == n:
|
||||
return 1
|
||||
else:
|
||||
return C(n - 1, k) + C(n - 1, k - 1)
|
||||
|
||||
|
||||
print(C(N, K))
|
||||
17
zeta_python/completed/11051.py
Normal file
17
zeta_python/completed/11051.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import sys
|
||||
sys.setrecursionlimit(12000)
|
||||
N, K = map(int, input().split())
|
||||
Mem = [[0]*1001for i in range(1001)]
|
||||
|
||||
def C(n, k):
|
||||
if n == 1:
|
||||
return 1
|
||||
elif k == 0 or k == n:
|
||||
return 1
|
||||
if Mem[n][k] != 0:
|
||||
return Mem[n][k]
|
||||
t = (C(n - 1, k) + C(n - 1, k - 1)) % 10007
|
||||
Mem[n][k] = t
|
||||
return t
|
||||
|
||||
print(C(N, K))
|
||||
8
zeta_python/completed/2609.py
Normal file
8
zeta_python/completed/2609.py
Normal file
@@ -0,0 +1,8 @@
|
||||
A, B = map(int, input().split())
|
||||
p = 1
|
||||
for i in range(A, 1, -1):
|
||||
if A % i == 0 and B % i == 0:
|
||||
p = i
|
||||
break
|
||||
print(p)
|
||||
print(A*B//p)
|
||||
Reference in New Issue
Block a user