結果

問題 No.1044 正直者大学
ユーザー brthyyjpbrthyyjp
提出日時 2021-02-22 22:58:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 2,022 ms
コンパイル使用メモリ 81,292 KB
実行使用メモリ 99,132 KB
最終ジャッジ日時 2023-10-21 17:08:26
合計ジャッジ時間 4,340 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
90,396 KB
testcase_01 AC 68 ms
90,396 KB
testcase_02 AC 69 ms
90,404 KB
testcase_03 AC 67 ms
90,396 KB
testcase_04 AC 68 ms
90,400 KB
testcase_05 AC 73 ms
90,420 KB
testcase_06 AC 129 ms
95,496 KB
testcase_07 AC 68 ms
90,400 KB
testcase_08 AC 68 ms
90,400 KB
testcase_09 AC 67 ms
90,400 KB
testcase_10 AC 67 ms
90,400 KB
testcase_11 AC 69 ms
90,400 KB
testcase_12 AC 86 ms
94,036 KB
testcase_13 AC 119 ms
97,052 KB
testcase_14 AC 89 ms
99,132 KB
testcase_15 AC 88 ms
95,188 KB
testcase_16 AC 116 ms
98,900 KB
testcase_17 AC 96 ms
96,256 KB
testcase_18 AC 107 ms
95,732 KB
testcase_19 AC 90 ms
95,704 KB
testcase_20 AC 71 ms
90,416 KB
testcase_21 AC 88 ms
94,528 KB
testcase_22 AC 69 ms
90,420 KB
testcase_23 AC 70 ms
90,424 KB
testcase_24 AC 70 ms
90,424 KB
testcase_25 AC 69 ms
90,420 KB
testcase_26 AC 70 ms
90,424 KB
testcase_27 AC 68 ms
90,400 KB
testcase_28 AC 67 ms
90,396 KB
testcase_29 AC 68 ms
90,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = 10**6
mod = 10**9+7
fac = [1]*(N+1)
finv = [1]*(N+1)
for i in range(N):
    fac[i+1] = fac[i] * (i+1) % mod
finv[-1] = pow(fac[-1], mod-2, mod)
for i in reversed(range(N)):
    finv[i] = finv[i+1] * (i+1) % mod

def cmb1(n, r, mod):
    if r <0 or r > n:
        return 0
    r = min(r, n-r)
    return fac[n] * finv[r] * finv[n-r] % mod

n, m, k = map(int, input().split())
mod = 10**9+7

ans = 0
for i in range(1, n+1):
    if i-1 > m-1:
        continue
    if n+m-2*i < k:
        continue
    ans += cmb1(n, i, mod)*cmb1(m-1, i-1, mod)*fac[m]*fac[n-1]
    ans %= mod
print(ans)
0