結果

問題 No.1126 SUM
ユーザー H3PO4H3PO4
提出日時 2020-07-24 22:14:36
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 163 ms / 1,000 ms
コード長 221 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 10,592 KB
実行使用メモリ 7,932 KB
最終ジャッジ日時 2023-09-08 04:26:50
合計ジャッジ時間 3,385 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
7,856 KB
testcase_01 AC 73 ms
7,792 KB
testcase_02 AC 50 ms
7,704 KB
testcase_03 AC 23 ms
7,868 KB
testcase_04 AC 70 ms
7,768 KB
testcase_05 AC 68 ms
7,812 KB
testcase_06 AC 56 ms
7,912 KB
testcase_07 AC 109 ms
7,780 KB
testcase_08 AC 101 ms
7,720 KB
testcase_09 AC 90 ms
7,784 KB
testcase_10 AC 26 ms
7,932 KB
testcase_11 AC 104 ms
7,908 KB
testcase_12 AC 127 ms
7,860 KB
testcase_13 AC 72 ms
7,784 KB
testcase_14 AC 34 ms
7,788 KB
testcase_15 AC 31 ms
7,768 KB
testcase_16 AC 95 ms
7,840 KB
testcase_17 AC 45 ms
7,876 KB
testcase_18 AC 94 ms
7,788 KB
testcase_19 AC 59 ms
7,848 KB
testcase_20 AC 57 ms
7,780 KB
testcase_21 AC 57 ms
7,788 KB
testcase_22 AC 56 ms
7,856 KB
testcase_23 AC 89 ms
7,716 KB
testcase_24 AC 93 ms
7,896 KB
testcase_25 AC 163 ms
7,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
MOD = 10 ** 9 + 7
modinv = lambda a, mod=MOD: pow(a, -1, mod)

tmp = 1
ans = 1
for i in range(N + 1, M + 1):
    tmp = tmp * i * modinv(i - N) % MOD
    ans = (ans + tmp) % MOD
print(ans)
0