結果

問題 No.1785 Inequality Signs
ユーザー nasubi24nasubi24
提出日時 2021-12-14 00:19:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 353 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 87,512 KB
最終ジャッジ日時 2023-09-30 06:21:23
合計ジャッジ時間 13,652 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,316 KB
testcase_01 AC 121 ms
77,976 KB
testcase_02 AC 276 ms
84,984 KB
testcase_03 AC 336 ms
82,280 KB
testcase_04 AC 80 ms
76,140 KB
testcase_05 AC 189 ms
81,500 KB
testcase_06 AC 307 ms
81,668 KB
testcase_07 AC 86 ms
76,224 KB
testcase_08 AC 299 ms
81,460 KB
testcase_09 AC 121 ms
78,016 KB
testcase_10 AC 247 ms
83,708 KB
testcase_11 AC 131 ms
78,360 KB
testcase_12 AC 176 ms
80,428 KB
testcase_13 AC 118 ms
77,684 KB
testcase_14 AC 200 ms
81,920 KB
testcase_15 AC 181 ms
80,712 KB
testcase_16 AC 159 ms
79,572 KB
testcase_17 AC 248 ms
83,828 KB
testcase_18 AC 249 ms
83,700 KB
testcase_19 AC 212 ms
82,092 KB
testcase_20 AC 233 ms
83,032 KB
testcase_21 AC 214 ms
82,356 KB
testcase_22 AC 127 ms
78,188 KB
testcase_23 AC 157 ms
79,648 KB
testcase_24 AC 353 ms
82,140 KB
testcase_25 AC 183 ms
80,912 KB
testcase_26 AC 181 ms
80,716 KB
testcase_27 AC 348 ms
82,512 KB
testcase_28 AC 347 ms
82,248 KB
testcase_29 AC 346 ms
82,368 KB
testcase_30 AC 344 ms
82,508 KB
testcase_31 AC 340 ms
82,512 KB
testcase_32 AC 350 ms
82,520 KB
testcase_33 AC 67 ms
71,016 KB
testcase_34 AC 92 ms
76,252 KB
testcase_35 AC 104 ms
78,828 KB
testcase_36 AC 260 ms
81,456 KB
testcase_37 AC 224 ms
82,292 KB
testcase_38 AC 205 ms
81,256 KB
testcase_39 AC 136 ms
80,444 KB
testcase_40 AC 154 ms
82,520 KB
testcase_41 AC 216 ms
86,208 KB
testcase_42 AC 319 ms
82,268 KB
testcase_43 AC 333 ms
82,420 KB
testcase_44 AC 292 ms
81,128 KB
testcase_45 AC 146 ms
82,492 KB
testcase_46 AC 211 ms
81,204 KB
testcase_47 AC 175 ms
85,056 KB
testcase_48 AC 222 ms
87,512 KB
testcase_49 AC 86 ms
76,248 KB
testcase_50 AC 289 ms
81,372 KB
testcase_51 AC 104 ms
76,272 KB
testcase_52 AC 91 ms
76,304 KB
testcase_53 AC 114 ms
78,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
mod=10**9+7
fac=[0]*(2*n+2)
cnt=1
fac[0]=1
for i in range(2*n+1):
    cnt*=k+n-i
    cnt%=mod
    fac[i+1]=cnt
fac2=[0]*(n+2)
fac2[0]=1
cnt=1
for i in range(n+1):
    cnt*=i+1
    cnt%=mod
    fac2[i+1]=cnt
gya=[0]*(n+2)
cnt=1
gya[0]=1
for i in range(n+1):
    cnt*=pow(i+1,mod-2,mod)
    cnt%=mod
    gya[i+1]=cnt
ans=0
for i in range(n):
    if i<=k-1:
        num=fac2[n-1]*gya[n-i-1]%mod
        num*=gya[i]
        num%=mod
        # k+n-1-i C n
        num2=(fac[i+n+1]*pow(fac[i+1],mod-2,mod))%mod
        num2*=gya[n]
        num2%=mod
        ans+=num*num2%mod
        ans%=mod
print(ans)
0