結果

問題 No.1044 正直者大学
ユーザー rlangevinrlangevin
提出日時 2023-02-14 08:54:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 608 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 84,928 KB
最終ジャッジ日時 2023-09-23 18:26:25
合計ジャッジ時間 5,349 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
78,928 KB
testcase_01 AC 78 ms
79,148 KB
testcase_02 AC 82 ms
79,008 KB
testcase_03 AC 80 ms
79,004 KB
testcase_04 AC 80 ms
78,992 KB
testcase_05 AC 82 ms
79,224 KB
testcase_06 AC 106 ms
81,432 KB
testcase_07 AC 81 ms
79,184 KB
testcase_08 AC 81 ms
78,900 KB
testcase_09 AC 79 ms
79,112 KB
testcase_10 AC 78 ms
79,028 KB
testcase_11 AC 79 ms
79,000 KB
testcase_12 AC 92 ms
81,500 KB
testcase_13 AC 103 ms
81,944 KB
testcase_14 AC 92 ms
84,928 KB
testcase_15 AC 94 ms
82,116 KB
testcase_16 AC 108 ms
84,060 KB
testcase_17 AC 90 ms
80,288 KB
testcase_18 AC 94 ms
80,532 KB
testcase_19 AC 99 ms
83,168 KB
testcase_20 AC 81 ms
79,024 KB
testcase_21 AC 97 ms
82,352 KB
testcase_22 AC 80 ms
79,064 KB
testcase_23 AC 80 ms
79,072 KB
testcase_24 AC 78 ms
79,048 KB
testcase_25 AC 78 ms
79,252 KB
testcase_26 AC 79 ms
79,176 KB
testcase_27 AC 78 ms
79,024 KB
testcase_28 AC 77 ms
78,992 KB
testcase_29 AC 77 ms
78,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, K = map(int, input().split())

mod = 10 ** 9 + 7

n = 205050

fact = [1] * (n + 1)
invfact = [1] * (n + 1)
for i in range(1, n):
    fact[i + 1] = ((i+1) * fact[i]) % mod
invfact[n] = pow(fact[n], mod - 2, mod)
for i in range(n - 1, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % mod

def comb(n, r):
    if n < 0 or r < 0 or n - r < 0:
        return 0
    return fact[n] * invfact[r] * invfact[n - r] % mod


ans = 0
for i in range(1, M + 1):
    if N + M - 2 * i < K:
        continue
    ans += comb(N, i) * comb(M - 1, i - 1)
    ans %= mod
ans *= fact[N - 1] * fact[M]
ans %= mod
print(ans)
0