結果

問題 No.940 ワープ ε=ε=ε=ε=ε=│;p>д<│
ユーザー tpynerivertpyneriver
提出日時 2019-12-04 21:29:34
言語 PyPy3
(7.3.13)
結果
RE  
実行時間 -
コード長 860 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 142,668 KB
最終ジャッジ日時 2023-08-21 02:51:53
合計ジャッジ時間 19,869 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
111,108 KB
testcase_01 AC 154 ms
111,152 KB
testcase_02 AC 148 ms
111,208 KB
testcase_03 AC 175 ms
112,000 KB
testcase_04 AC 147 ms
111,244 KB
testcase_05 AC 165 ms
111,928 KB
testcase_06 AC 162 ms
112,112 KB
testcase_07 AC 164 ms
112,012 KB
testcase_08 AC 155 ms
110,912 KB
testcase_09 AC 165 ms
111,784 KB
testcase_10 AC 164 ms
112,116 KB
testcase_11 AC 150 ms
111,380 KB
testcase_12 AC 166 ms
111,896 KB
testcase_13 AC 164 ms
112,024 KB
testcase_14 AC 151 ms
111,260 KB
testcase_15 AC 335 ms
121,572 KB
testcase_16 AC 736 ms
125,384 KB
testcase_17 AC 1,356 ms
127,712 KB
testcase_18 RE -
testcase_19 AC 1,345 ms
127,720 KB
testcase_20 RE -
testcase_21 AC 928 ms
124,788 KB
testcase_22 RE -
testcase_23 AC 780 ms
129,676 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

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(1341398)
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