結果

問題 No.1126 SUM
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-07-28 11:53:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 389 ms / 1,000 ms
コード長 341 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,580 KB
実行使用メモリ 16,020 KB
最終ジャッジ日時 2023-09-11 06:26:58
合計ジャッジ時間 8,853 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 325 ms
14,436 KB
testcase_01 AC 374 ms
15,540 KB
testcase_02 AC 158 ms
10,944 KB
testcase_03 AC 121 ms
10,036 KB
testcase_04 AC 382 ms
15,584 KB
testcase_05 AC 305 ms
14,112 KB
testcase_06 AC 190 ms
11,620 KB
testcase_07 AC 279 ms
13,612 KB
testcase_08 AC 288 ms
13,904 KB
testcase_09 AC 325 ms
14,376 KB
testcase_10 AC 334 ms
14,568 KB
testcase_11 AC 259 ms
13,056 KB
testcase_12 AC 335 ms
14,960 KB
testcase_13 AC 190 ms
11,732 KB
testcase_14 AC 240 ms
12,656 KB
testcase_15 AC 204 ms
12,004 KB
testcase_16 AC 328 ms
14,548 KB
testcase_17 AC 193 ms
11,644 KB
testcase_18 AC 272 ms
13,368 KB
testcase_19 AC 363 ms
15,488 KB
testcase_20 AC 187 ms
11,804 KB
testcase_21 AC 356 ms
15,224 KB
testcase_22 AC 267 ms
13,332 KB
testcase_23 AC 348 ms
14,908 KB
testcase_24 AC 247 ms
12,892 KB
testcase_25 AC 389 ms
16,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10 ** 9 + 7
def comb(m, r):
    if m < r:return 0
    if m < 0 or r < 0:return 0
    return fa[m] * fi[r] % mod * fi[m - r] % mod
n, m = map(int, input().split())
fa = [1] * (m + 2)
fi = [1] * (m + 2)
for i in range(1, m + 2):
    fa[i] = fa[i - 1] * i % mod
    fi[i] = pow(fa[i], mod - 2, mod)
ans = 0
print(comb(m + 1, n + 1) % mod)
0