промежутое

This commit is contained in:
2025-12-05 11:48:13 +05:00
parent 30647281a5
commit dcb80ef973
48 changed files with 1190 additions and 0 deletions

24
programm12.py Normal file
View File

@@ -0,0 +1,24 @@
f = open('INPUT.TXT')
n, m = map(int, f.readline().split())
f.close()
def factorial(x):
if x <= 1:
return 1
result = 1
for i in range(2, x + 1):
result = result * i
return result
def binomial(n, k):
if k > n or k < 0:
return 0
return factorial(n) // (factorial(k) * factorial(n - k))
count = 0
for k in range(m, n + 1):
count = count + binomial(n, k)
f = open('OUTPUT.TXT', 'w')
f.write(str(count))
f.close()