結果

問題 No.1126 SUM
ユーザー takakin
提出日時 2020-07-26 20:48:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 226 ms / 1,000 ms
コード長 426 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 26,496 KB
最終ジャッジ日時 2024-06-28 19:22:25
合計ジャッジ時間 6,372 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

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