結果

問題 No.1044 正直者大学
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-03-27 22:32:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 82,816 KB
最終ジャッジ日時 2024-04-24 07:40:45
合計ジャッジ時間 2,960 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
51,712 KB
testcase_01 AC 48 ms
51,712 KB
testcase_02 AC 49 ms
59,008 KB
testcase_03 AC 41 ms
52,224 KB
testcase_04 AC 41 ms
52,096 KB
testcase_05 AC 60 ms
64,512 KB
testcase_06 AC 96 ms
82,816 KB
testcase_07 AC 40 ms
51,840 KB
testcase_08 AC 41 ms
51,968 KB
testcase_09 AC 40 ms
52,224 KB
testcase_10 AC 41 ms
51,840 KB
testcase_11 AC 41 ms
52,224 KB
testcase_12 AC 71 ms
69,888 KB
testcase_13 AC 78 ms
75,904 KB
testcase_14 AC 71 ms
71,296 KB
testcase_15 AC 76 ms
72,960 KB
testcase_16 AC 74 ms
73,472 KB
testcase_17 AC 68 ms
68,864 KB
testcase_18 AC 73 ms
70,528 KB
testcase_19 AC 63 ms
66,304 KB
testcase_20 AC 53 ms
61,440 KB
testcase_21 AC 61 ms
65,664 KB
testcase_22 AC 52 ms
61,056 KB
testcase_23 AC 60 ms
65,920 KB
testcase_24 AC 59 ms
64,384 KB
testcase_25 AC 54 ms
61,440 KB
testcase_26 AC 63 ms
65,920 KB
testcase_27 AC 41 ms
52,096 KB
testcase_28 AC 40 ms
52,352 KB
testcase_29 AC 43 ms
52,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

def nCr(n,r):
    if r > n:
        return 0
    else: 
        return fact[n]*finv[r]%mod*finv[n-r]%mod


ans = 0

for i in range(1,n+1):
    c = nCr(n,i)
    if m < i or n-i+m-i < k:
        continue
    
    c2 = nCr(m,i)*fact[i]%mod
    c2 *= fact[m-i]*nCr(m-1,i-1)%mod
    ans += fact[n-1]*c%mod*c2%mod
    ans %= mod
print(ans)
0