結果

問題 No.1044 正直者大学
ユーザー pekempeypekempey
提出日時 2020-05-01 22:20:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 699 bytes
コンパイル時間 601 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 95,912 KB
最終ジャッジ日時 2023-08-26 14:50:12
合計ジャッジ時間 5,220 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
80,944 KB
testcase_01 AC 96 ms
81,216 KB
testcase_02 AC 97 ms
80,992 KB
testcase_03 AC 97 ms
81,020 KB
testcase_04 AC 94 ms
80,916 KB
testcase_05 AC 94 ms
80,980 KB
testcase_06 AC 151 ms
94,320 KB
testcase_07 AC 96 ms
81,060 KB
testcase_08 AC 95 ms
80,920 KB
testcase_09 AC 95 ms
80,916 KB
testcase_10 AC 95 ms
80,988 KB
testcase_11 AC 95 ms
81,000 KB
testcase_12 AC 128 ms
93,332 KB
testcase_13 AC 144 ms
94,224 KB
testcase_14 AC 134 ms
95,368 KB
testcase_15 AC 132 ms
94,140 KB
testcase_16 AC 153 ms
95,912 KB
testcase_17 AC 140 ms
94,156 KB
testcase_18 AC 141 ms
93,756 KB
testcase_19 AC 138 ms
95,120 KB
testcase_20 AC 125 ms
92,196 KB
testcase_21 AC 135 ms
94,400 KB
testcase_22 AC 95 ms
80,972 KB
testcase_23 AC 94 ms
80,972 KB
testcase_24 AC 94 ms
80,988 KB
testcase_25 AC 97 ms
81,180 KB
testcase_26 AC 98 ms
81,080 KB
testcase_27 AC 97 ms
80,920 KB
testcase_28 AC 97 ms
80,884 KB
testcase_29 AC 96 ms
81,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def input_int():
    return int(input())

def input_ints():
    return list(map(int, input().split()))

N, M, K = input_ints()

MOD = 10 ** 9 + 7

fact = [None] * 202020
inv = [None] * 202020
ifact = [None] * 202020
fact[0] = 1
fact[1] = 1
ifact[0] = 1
ifact[1] = 1
inv[1] = 1

for i in range(2, len(fact)):
    inv[i] = -inv[MOD % i] * (MOD // i) % MOD
    fact[i] = i * fact[i - 1] % MOD
    ifact[i] = inv[i] * ifact[i - 1] % MOD

def C(n, r):
    if n < 0 or r < 0 or n < r: return 0
    return fact[n] * ifact[r] * ifact[n - r] % MOD

ans = 0
for i in range(201020):
    if N + M - (i + 1) * 2 >= K:
        ans += C(N - 1, i) * C(M - 1, i) * fact[N] * fact[M] * inv[i + 1]

print(ans % MOD)


0