結果

問題 No.895 MESE
ユーザー tamatotamato
提出日時 2020-02-18 15:33:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 847 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 69,120 KB
最終ジャッジ日時 2024-04-16 04:09:39
合計ジャッジ時間 4,307 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
65,408 KB
testcase_01 AC 76 ms
65,152 KB
testcase_02 AC 76 ms
65,152 KB
testcase_03 AC 76 ms
64,768 KB
testcase_04 AC 76 ms
64,768 KB
testcase_05 AC 77 ms
65,280 KB
testcase_06 AC 78 ms
64,896 KB
testcase_07 AC 79 ms
64,896 KB
testcase_08 AC 78 ms
65,920 KB
testcase_09 AC 81 ms
66,304 KB
testcase_10 AC 80 ms
66,176 KB
testcase_11 AC 80 ms
66,432 KB
testcase_12 AC 78 ms
65,664 KB
testcase_13 AC 104 ms
68,480 KB
testcase_14 AC 132 ms
68,736 KB
testcase_15 AC 135 ms
68,992 KB
testcase_16 AC 118 ms
68,736 KB
testcase_17 AC 90 ms
68,608 KB
testcase_18 AC 146 ms
68,608 KB
testcase_19 AC 142 ms
68,608 KB
testcase_20 AC 141 ms
68,352 KB
testcase_21 AC 140 ms
68,480 KB
testcase_22 AC 145 ms
68,736 KB
testcase_23 AC 142 ms
68,352 KB
testcase_24 AC 141 ms
68,480 KB
testcase_25 AC 141 ms
68,992 KB
testcase_26 AC 149 ms
68,480 KB
testcase_27 AC 135 ms
68,736 KB
testcase_28 AC 142 ms
69,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.readline

    # comb init
    mod = 1000000007
    nmax = 3 * 10 ** 5 + 10  # change here
    fac = [0] * nmax
    finv = [0] * nmax
    inv = [0] * nmax
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

    def comb(n, r):
        if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod

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

    ans = 0
    for aa in range(a):
        tmp = ((comb(aa+b+c-2, c-1) * comb(aa+b-1, aa))%mod * (pow(2, aa+b+c-1, mod) - 1))%mod
        ans = (ans + tmp)%mod
    print(ans)


if __name__ == '__main__':
    main()
0