結果

問題 No.895 MESE
コンテスト
ユーザー MNGOF
提出日時 2019-09-30 04:54:14
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 819 ms / 2,000 ms
コード長 1,055 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 331 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 38,108 KB
最終ジャッジ日時 2026-04-19 06:48:57
合計ジャッジ時間 16,453 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def my_pow(a, n, r=1):
    # [a, n, m, r] = [底, 指数, 返値の最大値, 初項]
    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_mul(a, b):
    # a*b
    return (a * b) % 1000000007


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


output_max = 1000000000 + 7
s = input()
s = s.split()
inp = [int(tmp) for tmp in s]

a = inp[0]
b = inp[1]
c = inp[2]

# 階乗のチートシート作成
my_fact = [-1, 1, 1]
tmp = 1
for i in range(2, 300000):
    tmp *= i
    tmp %= output_max
    my_fact.append(tmp)

# 2のべき乗のチートシート作成
my_2xp = [1]
tmp = 1
for i in range(1, 299999):
    tmp *= 2
    tmp %= output_max
    my_2xp.append(tmp)

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]) % output_max
    res += my_div(tmp, my_fact[a - i])
    res %= output_max

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