結果

問題 No.895 MESE
ユーザー MNGOFMNGOF
提出日時 2019-09-30 05:07:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,217 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 34,560 KB
最終ジャッジ日時 2024-04-14 07:56:54
合計ジャッジ時間 21,360 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 229 ms
34,304 KB
testcase_01 AC 218 ms
34,304 KB
testcase_02 AC 220 ms
34,432 KB
testcase_03 AC 226 ms
34,432 KB
testcase_04 AC 222 ms
34,304 KB
testcase_05 AC 227 ms
34,432 KB
testcase_06 AC 215 ms
34,432 KB
testcase_07 AC 224 ms
34,432 KB
testcase_08 AC 228 ms
34,432 KB
testcase_09 AC 231 ms
34,432 KB
testcase_10 AC 231 ms
34,304 KB
testcase_11 AC 231 ms
34,432 KB
testcase_12 AC 221 ms
34,432 KB
testcase_13 AC 546 ms
34,432 KB
testcase_14 AC 1,062 ms
34,432 KB
testcase_15 AC 1,105 ms
34,304 KB
testcase_16 AC 767 ms
34,432 KB
testcase_17 AC 309 ms
34,304 KB
testcase_18 AC 1,200 ms
34,304 KB
testcase_19 AC 1,217 ms
34,432 KB
testcase_20 AC 1,211 ms
34,304 KB
testcase_21 AC 1,203 ms
34,560 KB
testcase_22 AC 1,199 ms
34,432 KB
testcase_23 AC 1,211 ms
34,432 KB
testcase_24 AC 1,201 ms
34,432 KB
testcase_25 AC 1,203 ms
34,432 KB
testcase_26 AC 1,203 ms
34,432 KB
testcase_27 AC 1,199 ms
34,304 KB
testcase_28 AC 1,212 ms
34,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def my_pow(a, n, r=1):
    r = ((r * a) % 1000000007) if n & 0b1 else r
    if n > 2:
        return my_pow((a * a) % 1000000007, n // 2, r)
    else:
        return r


def my_div(a, b):
    return (a * my_pow(b, 1000000005)) % 1000000007


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

my_fact = [-1, 1, 1]
tmp = 1
for i in range(2, 300000):
    my_fact.append(my_fact[-1] * i % 1000000007)

my_2xp = [1]
tmp = 1
for i in range(1, 299999):
    my_2xp.append(my_2xp[-1] * 2 % 1000000007)

res = 0
k = a + b + c - 1
for i in range(0, a):
    k -= 1
    tmp = my_2xp[k] - 1
    tmp = (tmp * my_fact[k]) % 1000000007
    res += my_div(tmp, my_fact[a - i])
    res %= 1000000007

res = my_div(res, (my_fact[b] * my_fact[c]) % 1000000007)
print(res)
0