結果

問題 No.1126 SUM
ユーザー takakintakakin
提出日時 2020-07-26 20:48:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 207 ms / 1,000 ms
コード長 426 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 24,004 KB
最終ジャッジ日時 2023-09-11 04:58:10
合計ジャッジ時間 6,685 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 207 ms
23,928 KB
testcase_01 AC 193 ms
23,768 KB
testcase_02 AC 167 ms
23,852 KB
testcase_03 AC 160 ms
23,788 KB
testcase_04 AC 176 ms
23,748 KB
testcase_05 AC 173 ms
23,900 KB
testcase_06 AC 172 ms
23,788 KB
testcase_07 AC 188 ms
23,792 KB
testcase_08 AC 185 ms
23,912 KB
testcase_09 AC 200 ms
23,948 KB
testcase_10 AC 161 ms
23,916 KB
testcase_11 AC 190 ms
23,752 KB
testcase_12 AC 197 ms
23,796 KB
testcase_13 AC 177 ms
23,992 KB
testcase_14 AC 177 ms
23,784 KB
testcase_15 AC 166 ms
23,796 KB
testcase_16 AC 183 ms
23,940 KB
testcase_17 AC 169 ms
23,792 KB
testcase_18 AC 188 ms
23,792 KB
testcase_19 AC 174 ms
23,792 KB
testcase_20 AC 173 ms
23,972 KB
testcase_21 AC 171 ms
23,748 KB
testcase_22 AC 170 ms
24,004 KB
testcase_23 AC 182 ms
23,788 KB
testcase_24 AC 192 ms
23,796 KB
testcase_25 AC 203 ms
23,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
mod=10**9+7
n,m=map(int,input().split())

n_max=2*(10**5+1)
F,FI=[0]*(n_max+1),[0]*(n_max+1)
F[0],FI[0]=1,1
for i in range(n_max):
  F[i+1]=(F[i]*(i+1))%mod
FI[n_max-1]=pow(F[n_max-1],mod-2,mod)
for i in reversed(range(n_max-1)):
  FI[i]=(FI[i+1]*(i+1))%mod
def comb(x,y):
  return (F[x]*FI[x-y]*FI[y])%mod
ans=0
for i in range(n,m+1):
	ans=(ans+comb(i,n))%mod
print(ans)
0