結果

問題 No.1520 Zigzag Sum
ユーザー nasubi24nasubi24
提出日時 2021-05-28 22:39:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 284 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 83,584 KB
最終ジャッジ日時 2024-04-25 00:36:53
合計ジャッジ時間 6,297 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 637 ms
82,816 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=4*10**5+10
a=[0]*n
b=[0]*n
c=1
d=1
mod=10**9+7
a[0]=1
b[0]=1
for i in range(1,n):
    c*=i
    c%=mod
    d*=pow(i,mod-2,mod)
    d%=mod
    a[i]=c
    b[i]=d
for i in range(int(input())):
    h,w=map(int,input().split())
    ans=a[h+w-2]*b[h-1]*b[w-1]%mod
    print((ans-1)*2%mod)
0