-
Notifications
You must be signed in to change notification settings - Fork 0
/
bck_11401.py
84 lines (61 loc) · 1.45 KB
/
bck_11401.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from sys import stdin
input = stdin.readline
N, K =map(int, input().split())
mod = 10**9 + 7
def Fectorial(number):
num = 1
for i in range(1, number+1):
num *= i
num %= mod
return num
def Power(n, k):
if (k==1):
return n
tmp = Power(n, k//2)
if k%2:
return tmp * tmp * n % mod
else:
return tmp * tmp % mod
print(Fectorial(N)%mod * (Power(Fectorial(K)*Fectorial(N-K), mod-2))%mod)
# from sys import stdin
# input = stdin.readline
# def Fectorial(number):
# fct = 1
# for i in range(1, number+1):
# fct *= i
# return fct
# def Power(n, k):
# if (k==1):
# return n
# elif (k==0):
# return 1
# tmp = Power(n, k//2)
# if (k%2 == 0):
# return tmp*tmp
# else:
# return n*tmp*tmp
# n, k = map(int, input().split())
# b = 10**9 + 7
# top = Fectorial(n)
# a = Fectorial(n-k) * Fectorial(k)
# # a : Fectorial(n-k) * Fectorial(k)
# print(Power(a, b-2)%b * top)
#---------------------------------------
# from sys import stdin
# input = stdin.readline
# n, k = map(int, input().split())
# #이항계수
# # n! / k!(n-k)!
# def Fectorial(number):
# fct = 1
# for i in range(1, number+1):
# fct *= i
# return fct
# n_fct = Fectorial(n)
# k_fct = Fectorial(k)
# nk_fct = Fectorial(n-k)
# # print(n_fct)
# # print(k_fct)
# # print(nk_fct)
# bino_coff = n_fct/(k_fct*nk_fct)
# print(int(bino_coff%1000000007))