結果

問題 No.895 MESE
ユーザー fuppy_kyoprofuppy_kyopro
提出日時 2019-09-10 01:45:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 376 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 2,503 ms
コンパイル使用メモリ 86,804 KB
実行使用メモリ 121,544 KB
最終ジャッジ日時 2023-09-15 12:59:06
合計ジャッジ時間 8,858 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,264 KB
testcase_01 AC 73 ms
71,276 KB
testcase_02 AC 72 ms
71,288 KB
testcase_03 AC 72 ms
71,488 KB
testcase_04 AC 74 ms
71,340 KB
testcase_05 AC 71 ms
71,220 KB
testcase_06 AC 71 ms
71,276 KB
testcase_07 AC 72 ms
71,084 KB
testcase_08 AC 82 ms
76,120 KB
testcase_09 AC 82 ms
76,364 KB
testcase_10 AC 83 ms
76,228 KB
testcase_11 AC 83 ms
76,280 KB
testcase_12 AC 81 ms
76,224 KB
testcase_13 AC 243 ms
104,800 KB
testcase_14 AC 261 ms
102,216 KB
testcase_15 AC 282 ms
107,232 KB
testcase_16 AC 243 ms
101,652 KB
testcase_17 AC 223 ms
100,036 KB
testcase_18 AC 373 ms
121,532 KB
testcase_19 AC 372 ms
119,152 KB
testcase_20 AC 373 ms
121,544 KB
testcase_21 AC 371 ms
118,984 KB
testcase_22 AC 375 ms
121,404 KB
testcase_23 AC 372 ms
119,236 KB
testcase_24 AC 376 ms
121,464 KB
testcase_25 AC 367 ms
119,184 KB
testcase_26 AC 370 ms
121,428 KB
testcase_27 AC 365 ms
119,232 KB
testcase_28 AC 370 ms
119,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/Users/fushishita/.pyenv/shims/python

import sys

MOD = 1000000007
fact = [1]
rfact = [1]

def mod_inverse(x):
    return pow(x, MOD - 2, MOD)

def nCr(n, r):
    if r > n:
        return 0
    ret = fact[n]
    ret = ret * rfact[r] % MOD
    ret = ret * rfact[n - r] % MOD
    return ret

a, b, c = list(map(int, input().split()))
n = a + b + c

for i in range(1, n + 1):
    fact.append(fact[i - 1] * i % MOD)
    rfact.append(mod_inverse(fact[i]))

ans = 0
for i in range(1, a + 1):
    x = a + b + c - i - 1
    add = pow(2, x, MOD) - 1
    add = add * nCr(x - 1, c - 1) % MOD * nCr(x - 1 - (c - 1), b - 1) % MOD
    ans = (ans + add) % MOD
ans = (ans + MOD) % MOD
print('{}\n'.format(ans), end='')
0