結果

問題 No.940 ワープ ε=ε=ε=ε=ε=│;p>д<│
ユーザー tpynerivertpyneriver
提出日時 2019-12-04 21:33:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,936 ms / 5,000 ms
コード長 865 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 171,376 KB
最終ジャッジ日時 2023-08-21 02:57:24
合計ジャッジ時間 25,180 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 189 ms
126,388 KB
testcase_01 AC 191 ms
126,604 KB
testcase_02 AC 193 ms
126,600 KB
testcase_03 AC 246 ms
150,020 KB
testcase_04 AC 189 ms
126,544 KB
testcase_05 AC 236 ms
150,420 KB
testcase_06 AC 234 ms
150,200 KB
testcase_07 AC 234 ms
150,548 KB
testcase_08 AC 224 ms
149,908 KB
testcase_09 AC 235 ms
150,632 KB
testcase_10 AC 233 ms
150,444 KB
testcase_11 AC 224 ms
149,812 KB
testcase_12 AC 239 ms
150,364 KB
testcase_13 AC 238 ms
150,460 KB
testcase_14 AC 222 ms
149,648 KB
testcase_15 AC 397 ms
154,308 KB
testcase_16 AC 801 ms
156,968 KB
testcase_17 AC 1,419 ms
159,168 KB
testcase_18 AC 1,788 ms
161,640 KB
testcase_19 AC 1,412 ms
158,952 KB
testcase_20 AC 2,261 ms
164,672 KB
testcase_21 AC 992 ms
156,484 KB
testcase_22 AC 2,167 ms
166,904 KB
testcase_23 AC 840 ms
161,100 KB
testcase_24 AC 2,228 ms
166,664 KB
testcase_25 AC 2,644 ms
171,376 KB
testcase_26 AC 2,936 ms
171,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline
mod = 10**9+7
def frac(limit):
    frac = [1]*limit
    for i in range(2,limit):
        frac[i] = i * frac[i-1]%mod
    fraci = [None]*limit
    fraci[-1] = pow(frac[-1], mod -2, mod)
    for i in range(-2, -limit-1, -1):
        fraci[i] = fraci[i+1] * (limit + i + 1) % mod
    return frac, fraci
frac, fraci = frac(2341398)
def comb(a, b):
    if not a >= b >= 0:
        return 0
    return frac[a]*fraci[b]*fraci[a-b]%mod

X, Y, Z = map(int, readline().split())
M = X+Y+Z+1

C = [0] + [(-1)**(M-k+1)*pow(2, k-1, mod)*comb(M, k)%mod for k in range(1, M+1)]
if M & 1:
    C[0] = 1
for i in range(1, M+1):
    C[i] = (C[i] + C[i-1]) % mod
ans = 0
for j in range(1, M):
    ans = (ans + C[j]*pow(pow(2, j, mod), mod-2, mod)*comb(X+j-1, X)*comb(Y+j-1, Y)*comb(Z+j-1, Z)) % mod
if M == 1:
    ans = 1
print(ans%mod)        
0