結果

問題 No.1044 正直者大学
ユーザー amyuamyu
提出日時 2020-05-01 22:46:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 80,548 KB
最終ジャッジ日時 2023-08-26 15:28:57
合計ジャッジ時間 3,641 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,340 KB
testcase_01 AC 63 ms
71,152 KB
testcase_02 AC 63 ms
71,448 KB
testcase_03 AC 62 ms
71,352 KB
testcase_04 AC 64 ms
71,628 KB
testcase_05 AC 70 ms
77,560 KB
testcase_06 AC 107 ms
80,548 KB
testcase_07 AC 68 ms
71,252 KB
testcase_08 AC 68 ms
71,584 KB
testcase_09 AC 67 ms
71,556 KB
testcase_10 AC 65 ms
71,404 KB
testcase_11 AC 63 ms
71,532 KB
testcase_12 AC 78 ms
78,936 KB
testcase_13 AC 96 ms
78,020 KB
testcase_14 AC 84 ms
77,772 KB
testcase_15 AC 82 ms
79,968 KB
testcase_16 AC 89 ms
78,180 KB
testcase_17 AC 80 ms
78,656 KB
testcase_18 AC 87 ms
78,860 KB
testcase_19 AC 76 ms
77,200 KB
testcase_20 AC 72 ms
76,736 KB
testcase_21 AC 77 ms
77,072 KB
testcase_22 AC 71 ms
77,008 KB
testcase_23 AC 70 ms
77,520 KB
testcase_24 AC 71 ms
77,504 KB
testcase_25 AC 72 ms
77,556 KB
testcase_26 AC 73 ms
77,748 KB
testcase_27 AC 63 ms
71,404 KB
testcase_28 AC 66 ms
71,528 KB
testcase_29 AC 66 ms
71,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k=map(int,input().split())

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=0
for i in range(1,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