結果

問題 No.1044 正直者大学
ユーザー amyuamyu
提出日時 2020-05-01 22:38:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 80,512 KB
最終ジャッジ日時 2023-08-26 15:22:48
合計ジャッジ時間 3,929 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,200 KB
testcase_01 AC 63 ms
71,136 KB
testcase_02 AC 65 ms
71,232 KB
testcase_03 AC 67 ms
71,284 KB
testcase_04 AC 65 ms
71,356 KB
testcase_05 WA -
testcase_06 AC 102 ms
80,512 KB
testcase_07 AC 64 ms
71,228 KB
testcase_08 AC 63 ms
71,488 KB
testcase_09 AC 64 ms
71,356 KB
testcase_10 AC 64 ms
71,568 KB
testcase_11 AC 64 ms
71,396 KB
testcase_12 AC 79 ms
78,800 KB
testcase_13 AC 89 ms
77,796 KB
testcase_14 AC 79 ms
77,612 KB
testcase_15 AC 80 ms
80,140 KB
testcase_16 AC 91 ms
78,040 KB
testcase_17 AC 80 ms
78,832 KB
testcase_18 AC 88 ms
78,836 KB
testcase_19 AC 77 ms
77,160 KB
testcase_20 AC 71 ms
76,704 KB
testcase_21 AC 76 ms
76,980 KB
testcase_22 AC 68 ms
77,052 KB
testcase_23 AC 69 ms
77,464 KB
testcase_24 AC 72 ms
77,420 KB
testcase_25 AC 72 ms
77,744 KB
testcase_26 AC 73 ms
77,764 KB
testcase_27 AC 64 ms
71,356 KB
testcase_28 AC 65 ms
71,356 KB
testcase_29 AC 63 ms
71,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k=map(int,input().split())
if n+m-1<=k:
    print(0)
    quit()
mod=10**9+7
if m>n:
    n,m=m,n
N=n
fac=[1]*(N+3)
inv=[1]*(N+3)
t=1
for i in range(1,N+3):
    t*=i
    t%=mod
    fac[i]=t
t=pow(fac[N+2],mod-2,mod)
for i in range(N+2,0,-1):
    inv[i]=t
    t*=i
    t%=mod
def comb(n,r):
    if r>n or r<0:
        return 0
    return fac[n]*inv[n-r]*inv[r]%mod
ans=fac[n-1]*n*fac[m]
for i in range(2,m+1):
    if n+m-i*2<k:
        break
    ans+=fac[n-1]*comb(n,i)%mod*fac[m]*comb(m-1,i-1)%mod
    ans%=mod
print(ans)
0