조합
This commit is contained in:
9
zeta_python/2981.py
Normal file
9
zeta_python/2981.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
N = int(input())
|
||||||
|
I = sorted([int(input())for i in range(N)])
|
||||||
|
p = min([(j-i) for i, j in zip(I, I[1:])])
|
||||||
|
print(p)
|
||||||
|
T = [t for t in range(1, int(p**(1/2))+1) if p % t == 0]
|
||||||
|
if T[-1] == p // T[-1]:
|
||||||
|
print(" ".join([str(t) for t in T[1:-1]] + [str(p // t) for t in T[::-1]]))
|
||||||
|
else:
|
||||||
|
print(" ".join([str(t) for t in T[1:]] + [str(p // t) for t in T[::-1]]))
|
||||||
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